use of io.grpc.examples.helloworld.Greeter.GreeterService in project servicetalk by apple.
the class GrpcUdsTest method udsRoundTrip.
@Test
void udsRoundTrip() throws Exception {
Assumptions.assumeTrue(ioExecutor.isUnixDomainSocketSupported());
String greetingPrefix = "Hello ";
String name = "foo";
String expectedResponse = greetingPrefix + name;
try (ServerContext serverContext = forAddress(newSocketAddress()).initializeHttp(builder -> builder.ioExecutor(ioExecutor)).listenAndAwait((GreeterService) (ctx, request) -> succeeded(HelloReply.newBuilder().setMessage(greetingPrefix + request.getName()).build()));
BlockingGreeterClient client = forResolvedAddress(serverContext.listenAddress()).buildBlocking(new ClientFactory())) {
assertEquals(expectedResponse, client.sayHello(HelloRequest.newBuilder().setName(name).build()).getMessage());
}
}
Aggregations