@Override
    public <T extends RequestCommand> boolean serializeContent(T request, InvokeContext invokeContext)
                                                                                                      throws SerializationException {
        final RpcRequestCommand cmd = (RpcRequestCommand) request;
        final Message msg = (Message) cmd.getRequestObject();
        cmd.setContent(msg.toByteArray());
        return true;
    }
RPC custom serializer based on protobuf
@author boyan (boyan@alibaba-inc.com)

2018-Mar-26 4:43:21 PM
jraft-core/src/main/java/com/alipay/sofa/jraft/rpc/ProtobufSerializer.java