private static ByteBuffer serializeDoc(Document doc) {
        var buf = new GrowableByteBuffer(8 * 1024, 2.0f);
        doc.serialize(DocumentSerializerFactory.createHead(buf));
        buf.flip();
        return buf.getByteBuffer();
    }
Implementation of MessageBus message request/response serialization built around Protocol Buffers.
documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/RoutableFactories80.java