private <T> T testRoundTripSerialize(ThriftCodec<T> readCodec, ThriftCodec<T> writeCodec, Type structType, T structInstance, TProtocolFactory protocolFactory)
throws Exception
{
ThriftCatalog readCatalog = readCodecManager.getCatalog();
ThriftStructMetadata readMetadata = readCatalog.getThriftStructMetadata(structType);
assertNotNull(readMetadata);
ThriftCatalog writeCatalog = writeCodecManager.getCatalog();
ThriftStructMetadata writeMetadata = writeCatalog.getThriftStructMetadata(structType);
assertNotNull(writeMetadata);
TMemoryBuffer transport = new TMemoryBuffer(10 * 1024);
TProtocol protocol = protocolFactory.getProtocol(transport);
writeCodec.write(structInstance, protocol);