@Override
    public RpcServer createRpcServer(final Endpoint endpoint, final ConfigHelper<RpcServer> helper) {
        final int port = Requires.requireNonNull(endpoint, "endpoint").getPort();
        Requires.requireTrue(port > 0 && port < 0xFFFF, "port out of range:" + port);
        final MutableHandlerRegistry handlerRegistry = new MutableHandlerRegistry();
        final Server server = ServerBuilder.forPort(port) //
            .fallbackHandlerRegistry(handlerRegistry) //
            .directExecutor() //
            .maxInboundMessageSize(RPC_MAX_INBOUND_MESSAGE_SIZE) //
            .build();
        final RpcServer rpcServer = new GrpcServer(server, handlerRegistry, this.parserClasses, getMarshallerRegistry());
        if (helper != null) {
            helper.config(rpcServer);
        }
        return rpcServer;
    }
@author nicholas.jxf
@author jiachun.fjc
jraft-extension/rpc-grpc-impl/src/main/java/com/alipay/sofa/jraft/rpc/impl/GrpcRaftRpcFactory.java