@Override
    public <T extends ResponseCommand> boolean serializeContent(T response) throws SerializationException {
        final RpcResponseCommand cmd = (RpcResponseCommand) response;
        final Message msg = (Message) cmd.getResponseObject();
        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