Search in sources :

Example 6 with ClientTransportOptions

use of io.grpc.internal.ClientTransportFactory.ClientTransportOptions in project grpc-java by grpc.

the class ManagedChannelImplTest method createSubchannel_resolverOverrideAuthority.

@Test
public void createSubchannel_resolverOverrideAuthority() {
    EquivalentAddressGroup addressGroup = new EquivalentAddressGroup(socketAddress, Attributes.newBuilder().set(ATTR_AUTHORITY_OVERRIDE, "resolver.override.authority").build());
    channelBuilder.nameResolverFactory(new FakeNameResolverFactory.Builder(expectedUri).setServers(Collections.singletonList(addressGroup)).build());
    createChannel();
    Subchannel subchannel = createSubchannelSafely(helper, addressGroup, Attributes.EMPTY, subchannelStateListener);
    requestConnectionSafely(helper, subchannel);
    ArgumentCaptor<ClientTransportOptions> transportOptionCaptor = ArgumentCaptor.forClass(null);
    verify(mockTransportFactory).newClientTransport(any(SocketAddress.class), transportOptionCaptor.capture(), any(ChannelLogger.class));
    assertThat(transportOptionCaptor.getValue().getAuthority()).isEqualTo("resolver.override.authority");
}
Also used : ClientTransportOptions(io.grpc.internal.ClientTransportFactory.ClientTransportOptions) EquivalentAddressGroup(io.grpc.EquivalentAddressGroup) ForwardingSubchannel(io.grpc.util.ForwardingSubchannel) Subchannel(io.grpc.LoadBalancer.Subchannel) ChannelLogger(io.grpc.ChannelLogger) ProxiedSocketAddress(io.grpc.ProxiedSocketAddress) SocketAddress(java.net.SocketAddress) Test(org.junit.Test)

Example 7 with ClientTransportOptions

use of io.grpc.internal.ClientTransportFactory.ClientTransportOptions in project grpc-java by grpc.

the class ClientTransportFactoryTest method clientTransportOptions_init_checkNotNulls.

@Test
public void clientTransportOptions_init_checkNotNulls() {
    ClientTransportOptions cto = new ClientTransportOptions();
    assertThat(cto.getAuthority()).isNotNull();
    assertThat(cto.getEagAttributes()).isEqualTo(Attributes.EMPTY);
}
Also used : ClientTransportOptions(io.grpc.internal.ClientTransportFactory.ClientTransportOptions) Test(org.junit.Test)

Example 8 with ClientTransportOptions

use of io.grpc.internal.ClientTransportFactory.ClientTransportOptions in project grpc-java by grpc.

the class ClientTransportFactoryTest method clientTransportOptions_getsMatchSets.

@Test
public void clientTransportOptions_getsMatchSets() {
    ClientTransportOptions cto = new ClientTransportOptions().setAuthority(authority).setEagAttributes(eagAttributes).setUserAgent(userAgent).setHttpConnectProxiedSocketAddress(proxySocketAddress);
    assertThat(cto.getAuthority()).isEqualTo(authority);
    assertThat(cto.getEagAttributes()).isEqualTo(eagAttributes);
    assertThat(cto.getUserAgent()).isEqualTo(userAgent);
    assertThat(cto.getHttpConnectProxiedSocketAddress()).isSameInstanceAs(proxySocketAddress);
}
Also used : ClientTransportOptions(io.grpc.internal.ClientTransportFactory.ClientTransportOptions) Test(org.junit.Test)

Aggregations

ClientTransportOptions (io.grpc.internal.ClientTransportFactory.ClientTransportOptions)8 Test (org.junit.Test)8 ChannelLogger (io.grpc.ChannelLogger)3 Subchannel (io.grpc.LoadBalancer.Subchannel)3 Metadata (io.grpc.Metadata)3 ProxiedSocketAddress (io.grpc.ProxiedSocketAddress)3 ForwardingSubchannel (io.grpc.util.ForwardingSubchannel)3 SocketAddress (java.net.SocketAddress)3 EquivalentAddressGroup (io.grpc.EquivalentAddressGroup)2 Status (io.grpc.Status)2 CronetTransportFactory (io.grpc.cronet.CronetChannelBuilder.CronetTransportFactory)2 MockClientTransportInfo (io.grpc.internal.TestUtils.MockClientTransportInfo)2 InetSocketAddress (java.net.InetSocketAddress)2 Attributes (io.grpc.Attributes)1 ClientStreamTracer (io.grpc.ClientStreamTracer)1 SubchannelStateListener (io.grpc.LoadBalancer.SubchannelStateListener)1 ManagedChannel (io.grpc.ManagedChannel)1 TransportLogger (io.grpc.internal.InternalSubchannel.TransportLogger)1 ArrayList (java.util.ArrayList)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1