// try to use a message marshaller
MessageMarshaller marshaller = ctx.getMarshaller(t.getClass());
out.writeString(wrappedDescriptorFullName, marshaller.getFullName());
ByteArrayOutputStream buffer = new ByteArrayOutputStream(); //todo here we should use a better buffer allocation strategy
ProtobufWriterImpl writer = new ProtobufWriterImpl(ctx);
writer.write(CodedOutputStream.newInstance(buffer), t);
out.writeTag(wrappedMessageBytes, WireFormat.WIRETYPE_LENGTH_DELIMITED);
out.writeRawVarint32(buffer.size());
out.writeRawBytes(buffer.toByteArray());
}