File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
examples/example-tls/src/main/java/io/grpc/examples/helloworldtls Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 1616
1717package io .grpc .examples .helloworldtls ;
1818
19+ import static io .grpc .examples .helloworld .GreeterGrpc .getSayHelloMethod ;
20+
21+ import io .grpc .CallOptions ;
1922import io .grpc .Channel ;
2023import io .grpc .Grpc ;
2124import io .grpc .ManagedChannel ;
2528import io .grpc .examples .helloworld .HelloReply ;
2629import io .grpc .examples .helloworld .HelloRequest ;
2730import java .io .File ;
31+ import java .io .IOException ;
2832import java .util .concurrent .TimeUnit ;
2933import java .util .logging .Level ;
3034import java .util .logging .Logger ;
@@ -52,7 +56,11 @@ public void greet(String name) {
5256 HelloRequest request = HelloRequest .newBuilder ().setName (name ).build ();
5357 HelloReply response ;
5458 try {
55- response = blockingStub .sayHello (request );
59+ CallOptions callOptions = blockingStub .getCallOptions ()
60+ .withAuthority ("moo.test.goog.fr" );
61+ response = io .grpc .stub .ClientCalls .blockingUnaryCall (
62+ blockingStub .getChannel (), getSayHelloMethod (),
63+ callOptions , request );
5664 } catch (StatusRuntimeException e ) {
5765 logger .log (Level .WARNING , "RPC failed: {0}" , e .getStatus ());
5866 return ;
You can’t perform that action at this time.
0 commit comments