private static TraceServiceGrpc . TraceServiceStub getTraceServiceStub ( String endPoint , Boolean useInsecure , SslContext sslContext ) { ManagedChannelBuilder < ? > channelBuilder ; if ( useInsecure ) { channelBuilder = ManagedChannelBuilder . forTarget ( endPoint ) . usePlaintext ( ) ; } else { channelBuilder = NettyChannelBuilder . forTarget ( endPoint ) . negotiationType ( NegotiationType . TLS ) . sslContext ( sslContext ) ; } ManagedChannel channel = channelBuilder . build ( ) ; return TraceServiceGrpc . newStub ( channel ) ; }
One stub can be used for both Export RPC and Config RPC .