}
});
}
private <T extends TBase> void internalTestSerialization(Class<T> klass, T expected) throws Exception {
TMemoryBuffer buf = new TMemoryBuffer(0);
TBinaryProtocol binproto = new TBinaryProtocol(buf);
expected.write(binproto);
buf = new TMemoryBuffer(0);
TProtocol proto = getFactory().getProtocol(buf);
expected.write(proto);
System.out.println("Size in " + proto.getClass().getSimpleName() + ": " + buf.length());
T actual = klass.newInstance();
actual.read(proto);
assertEquals(expected, actual);
}