use of io.grpc.ServerCredentials in project grpc-java by grpc.
the class ProtocolNegotiatorsTest method from_tls_clientAuthOptional_clientCert.
@Test
public void from_tls_clientAuthOptional_clientCert() throws Exception {
ServerCredentials serverCreds = TlsServerCredentials.newBuilder().keyManager(server1Cert, server1Key).trustManager(caCert).clientAuth(TlsServerCredentials.ClientAuth.OPTIONAL).build();
ChannelCredentials channelCreds = TlsChannelCredentials.newBuilder().keyManager(server1Cert, server1Key).trustManager(caCert).build();
InternalChannelz.Tls tls = expectSuccessfulHandshake(channelCreds, serverCreds);
assertThat(((X509Certificate) tls.remoteCert).getSubjectX500Principal().getName()).contains("CN=*.test.google.com");
}
use of io.grpc.ServerCredentials in project grpc-java by grpc.
the class XdsSdsClientServerTest method buildServerWithFallbackServerCredentials.
private void buildServerWithFallbackServerCredentials(ServerCredentials fallbackCredentials, DownstreamTlsContext downstreamTlsContext) throws Exception {
ServerCredentials xdsCredentials = XdsServerCredentials.create(fallbackCredentials);
XdsServerBuilder builder = XdsServerBuilder.forPort(0, xdsCredentials).xdsClientPoolFactory(fakePoolFactory).addService(new SimpleServiceImpl());
buildServer(builder, downstreamTlsContext);
}
Aggregations