Search in sources :

Example 1 with PlaintextProtocolNegotiatorClientFactory

use of io.grpc.netty.ProtocolNegotiators.PlaintextProtocolNegotiatorClientFactory in project grpc-java by grpc.

the class NettyChannelBuilderTest method transportFactorySupportsNettyChannelCreds.

@Test
public void transportFactorySupportsNettyChannelCreds() {
    NettyChannelBuilder builder = NettyChannelBuilder.forTarget("foo");
    ClientTransportFactory transportFactory = builder.buildTransportFactory();
    SwapChannelCredentialsResult result = transportFactory.swapChannelCredentials(mock(ChannelCredentials.class));
    assertThat(result).isNull();
    result = transportFactory.swapChannelCredentials(NettyChannelCredentials.create(new PlaintextProtocolNegotiatorClientFactory()));
    assertThat(result).isNotNull();
}
Also used : ClientTransportFactory(io.grpc.internal.ClientTransportFactory) InsecureChannelCredentials(io.grpc.InsecureChannelCredentials) ChannelCredentials(io.grpc.ChannelCredentials) SwapChannelCredentialsResult(io.grpc.internal.ClientTransportFactory.SwapChannelCredentialsResult) PlaintextProtocolNegotiatorClientFactory(io.grpc.netty.ProtocolNegotiators.PlaintextProtocolNegotiatorClientFactory) TrackingObjectPoolForTest(io.grpc.netty.NettyTestUtil.TrackingObjectPoolForTest) Test(org.junit.Test)

Aggregations

ChannelCredentials (io.grpc.ChannelCredentials)1 InsecureChannelCredentials (io.grpc.InsecureChannelCredentials)1 ClientTransportFactory (io.grpc.internal.ClientTransportFactory)1 SwapChannelCredentialsResult (io.grpc.internal.ClientTransportFactory.SwapChannelCredentialsResult)1 TrackingObjectPoolForTest (io.grpc.netty.NettyTestUtil.TrackingObjectPoolForTest)1 PlaintextProtocolNegotiatorClientFactory (io.grpc.netty.ProtocolNegotiators.PlaintextProtocolNegotiatorClientFactory)1 Test (org.junit.Test)1