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");
}
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);
}
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);
}
Aggregations