public static GrpcTransportChannel create(ManagedChannel channel) { return newBuilder().setManagedChannel(channel).build(); }
public static GrpcTransportChannel create(ManagedChannel channel) { return newBuilder().setManagedChannel(channel).build(); }
@Override public TransportChannel getTransportChannel() throws IOException { ManagedChannelBuilder channelBuilder = InProcessChannelBuilder.forName(address).usePlaintext(); if (headerProvider != null) { GrpcHeaderInterceptor interceptor = new GrpcHeaderInterceptor(headerProvider.getHeaders()); LocalHeaderInterceptor localHeaderInterceptor = new LocalHeaderInterceptor(interceptor); interceptors.add(localHeaderInterceptor); channelBuilder.intercept(localHeaderInterceptor).userAgent(interceptor.getUserAgentHeader()); } return GrpcTransportChannel.newBuilder().setManagedChannel(channelBuilder.build()).build(); }
TransportChannelProvider operationsChannelProvider = mock(TransportChannelProvider.class); TransportChannel transportChannel = GrpcTransportChannel.newBuilder().setManagedChannel(channel).build(); when(operationsChannelProvider.getTransportChannel()).thenReturn(transportChannel); ClientContext.newBuilder() .setTransportChannel( GrpcTransportChannel.newBuilder().setManagedChannel(channel).build()) .setExecutor(executor) .setDefaultCallContext(GrpcCallContext.of(channel, CallOptions.DEFAULT))