use of io.grpc.examples.hostname.HostnameGreeter in project grpc-java by grpc.
the class HostnameGreeterTest method sayHello_fixedHostname.
@Test
public void sayHello_fixedHostname() throws Exception {
grpcCleanup.register(InProcessServerBuilder.forName("hostname").directExecutor().addService(new HostnameGreeter("me")).build().start());
HelloReply reply = blockingStub.sayHello(HelloRequest.newBuilder().setName("you").build());
assertEquals("Hello you, from me", reply.getMessage());
}
use of io.grpc.examples.hostname.HostnameGreeter in project grpc-java by grpc.
the class HostnameGreeterTest method sayHello_dynamicHostname.
@Test
public void sayHello_dynamicHostname() throws Exception {
grpcCleanup.register(InProcessServerBuilder.forName("hostname").directExecutor().addService(new HostnameGreeter(null)).build().start());
// Just verifing the service doesn't crash
HelloReply reply = blockingStub.sayHello(HelloRequest.newBuilder().setName("anonymous").build());
assertTrue(reply.getMessage(), reply.getMessage().startsWith("Hello anonymous, from "));
}
Aggregations