Search in sources :

Example 1 with TlsContextManagerImpl

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()));
}
Also used : InetSocketAddress(java.net.InetSocketAddress) EquivalentAddressGroup(io.grpc.EquivalentAddressGroup) Attributes(io.grpc.Attributes) TlsContextManagerImpl(io.grpc.xds.internal.sds.TlsContextManagerImpl) SslContextProviderSupplier(io.grpc.xds.internal.sds.SslContextProviderSupplier)

Example 2 with TlsContextManagerImpl

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);
}
Also used : ManagedChannelBuilder(io.grpc.ManagedChannelBuilder) LdsUpdate(io.grpc.xds.XdsClient.LdsUpdate) URI(java.net.URI) TlsContextManagerImpl(io.grpc.xds.internal.sds.TlsContextManagerImpl)

Aggregations

TlsContextManagerImpl (io.grpc.xds.internal.sds.TlsContextManagerImpl)2 Attributes (io.grpc.Attributes)1 EquivalentAddressGroup (io.grpc.EquivalentAddressGroup)1 ManagedChannelBuilder (io.grpc.ManagedChannelBuilder)1 LdsUpdate (io.grpc.xds.XdsClient.LdsUpdate)1 SslContextProviderSupplier (io.grpc.xds.internal.sds.SslContextProviderSupplier)1 InetSocketAddress (java.net.InetSocketAddress)1 URI (java.net.URI)1