use of io.grpc.xds.internal.sds.TlsContextManagerImpl in project grpc-java by grpc.
the class XdsSdsClientServerTest method getBlockingStub.
private SimpleServiceGrpc.SimpleServiceBlockingStub getBlockingStub(final UpstreamTlsContext upstreamTlsContext, String overrideAuthority) throws URISyntaxException {
ManagedChannelBuilder<?> channelBuilder = Grpc.newChannelBuilder("sdstest://localhost:" + port, XdsChannelCredentials.create(InsecureChannelCredentials.create()));
if (overrideAuthority != null) {
channelBuilder = channelBuilder.overrideAuthority(overrideAuthority);
}
InetSocketAddress socketAddress = new InetSocketAddress(Inet4Address.getLoopbackAddress(), port);
tlsContextManagerForClient = new TlsContextManagerImpl(bootstrapInfoForClient);
Attributes attrs = (upstreamTlsContext != null) ? Attributes.newBuilder().set(InternalXdsAttributes.ATTR_SSL_CONTEXT_PROVIDER_SUPPLIER, new SslContextProviderSupplier(upstreamTlsContext, tlsContextManagerForClient)).build() : Attributes.EMPTY;
fakeNameResolverFactory.setServers(ImmutableList.of(new EquivalentAddressGroup(socketAddress, attrs)));
return SimpleServiceGrpc.newBlockingStub(cleanupRule.register(channelBuilder.build()));
}
use of io.grpc.xds.internal.sds.TlsContextManagerImpl in project grpc-java by grpc.
the class XdsSdsClientServerTest method buildServer.
private void buildServer(XdsServerBuilder builder, DownstreamTlsContext downstreamTlsContext) throws Exception {
tlsContextManagerForServer = new TlsContextManagerImpl(bootstrapInfoForServer);
XdsServerWrapper xdsServer = (XdsServerWrapper) builder.build();
SettableFuture<Throwable> startFuture = startServerAsync(xdsServer);
EnvoyServerProtoData.Listener listener = buildListener("listener1", "10.1.2.3", downstreamTlsContext, tlsContextManagerForServer);
LdsUpdate listenerUpdate = LdsUpdate.forTcpListener(listener);
xdsClient.deliverLdsUpdate(listenerUpdate);
startFuture.get(10, TimeUnit.SECONDS);
port = xdsServer.getPort();
URI expectedUri = new URI("sdstest://localhost:" + port);
fakeNameResolverFactory = new FakeNameResolverFactory.Builder(expectedUri).build();
NameResolverRegistry.getDefaultRegistry().register(fakeNameResolverFactory);
}
Aggregations