1818
1919import static io .grpc .examples .helloworld .GreeterGrpc .getSayHelloMethod ;
2020
21+ import io .grpc .CallOptions ;
2122import io .grpc .Channel ;
2223import io .grpc .Grpc ;
2324import io .grpc .ManagedChannel ;
2728import io .grpc .examples .helloworld .HelloReply ;
2829import io .grpc .examples .helloworld .HelloRequest ;
2930import java .io .File ;
31+ import java .io .IOException ;
3032import java .util .concurrent .TimeUnit ;
3133import java .util .logging .Level ;
3234import java .util .logging .Logger ;
@@ -50,13 +52,15 @@ public HelloWorldClientTls(Channel channel) {
5052 * Say hello to server.
5153 */
5254 public void greet (String name ) {
53- System .setProperty ("GRPC_ENABLE_PER_RPC_AUTHORITY_CHECK" , "true" );
5455 logger .info ("Will try to greet " + name + " ..." );
5556 HelloRequest request = HelloRequest .newBuilder ().setName (name ).build ();
5657 HelloReply response ;
5758 try {
59+ CallOptions callOptions = blockingStub .getCallOptions ()
60+ .withAuthority ("moo.test.goog.fr" );
5861 response = io .grpc .stub .ClientCalls .blockingUnaryCall (
59- blockingStub .getChannel (), getSayHelloMethod (), blockingStub .getCallOptions ().withAuthority ("foo.goog.test.in" ), request );
62+ blockingStub .getChannel (), getSayHelloMethod (),
63+ callOptions , request );
6064 } catch (StatusRuntimeException e ) {
6165 logger .log (Level .WARNING , "RPC failed: {0}" , e .getStatus ());
6266 return ;
0 commit comments