use of io.grpc.testing.protobuf.SimpleServiceGrpc.SimpleServiceBlockingStub in project grpc-java by grpc.
the class ShadingTest method basic.
@Test
public void basic() throws Exception {
server = Grpc.newServerBuilderForPort(0, InsecureServerCredentials.create()).addService(new SimpleServiceImpl()).build().start();
channel = Grpc.newChannelBuilder("localhost:" + server.getPort(), InsecureChannelCredentials.create()).build();
SimpleServiceBlockingStub stub = SimpleServiceGrpc.newBlockingStub(channel);
assertThat(SimpleResponse.getDefaultInstance()).isEqualTo(stub.unaryRpc(SimpleRequest.getDefaultInstance()));
}
use of io.grpc.testing.protobuf.SimpleServiceGrpc.SimpleServiceBlockingStub in project grpc-java by grpc.
the class ShadingTest method tcnative.
@Test
public void tcnative() throws Exception {
ServerCredentials serverCreds = TlsServerCredentials.create(TestUtils.loadCert("server1.pem"), TestUtils.loadCert("server1.key"));
server = Grpc.newServerBuilderForPort(0, serverCreds).addService(new SimpleServiceImpl()).build().start();
ChannelCredentials creds = NettySslContextChannelCredentials.create(GrpcSslContexts.configure(SslContextBuilder.forClient(), SslProvider.OPENSSL).trustManager(TestUtils.loadCert("ca.pem")).build());
channel = Grpc.newChannelBuilder("localhost:" + server.getPort(), creds).overrideAuthority("foo.test.google.fr").build();
SimpleServiceBlockingStub stub = SimpleServiceGrpc.newBlockingStub(channel);
assertThat(SimpleResponse.getDefaultInstance()).isEqualTo(stub.unaryRpc(SimpleRequest.getDefaultInstance()));
}
Aggregations