@Override
    public <T extends RequestCommand> boolean deserializeHeader(T request) throws DeserializationException {
        final RpcRequestCommand cmd = (RpcRequestCommand) request;
        final String className = cmd.getRequestClass();
        if (className.equals(RpcRequests.AppendEntriesRequest.class.getName())) {
            final byte[] header = cmd.getHeader();
            cmd.setRequestHeader(ProtobufMsgFactory.newMessageByJavaClassName(
                RpcRequests.AppendEntriesRequestHeader.class.getName(), header));
            return true;
        }
        return false;
    }
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