public ByteBuf serializeRequest(I message) throws IOException {
        switch (requestType) {
            case PROTOBUF:
                final PrototypeMarshaller<I> marshaller = (PrototypeMarshaller<I>) requestMarshaller;
                return serializeProto(marshaller, (Message) message);
            default:
                // TODO(minwoox) Optimize this by creating buffer with the sensible initial capacity.
                final CompositeByteBuf out = alloc.compositeBuffer();
                try (ByteBufOutputStream os = new ByteBufOutputStream(out)) {
                    if (isProto) {
                        try (InputStream is = method.streamRequest(message)) {
                            ByteStreams.copy(is, os);
                        }
                    } else {
                        assert jsonMarshaller != null;
                        jsonMarshaller.serializeMessage(requestMarshaller, message, os);
                    }
                }
                return out;
        }
    }
Marshaller for gRPC method request or response messages to and from {@link ByteBuf}. Will attempt to use
optimized code paths for known message types, and otherwise delegates to the gRPC stub.
grpc/src/main/java/com/linecorp/armeria/internal/common/grpc/GrpcMessageMarshaller.java