@Test public void pickerReturnsStreamTracer_delayed() { ClientStream mockStream = mock(ClientStream.class); ClientStreamTracer.Factory factory1 = mock(ClientStreamTracer.Factory.class); ClientStreamTracer.Factory factory2 = mock(ClientStreamTracer.Factory.class); createChannel(); CallOptions callOptions = CallOptions.DEFAULT.withStreamTracerFactory(factory1); ClientCall<String, Integer> call = channel.newCall(method, callOptions); call.start(mockCallListener, new Metadata()); Subchannel subchannel = createSubchannelSafely(helper, addressGroup, Attributes.EMPTY); subchannel.requestConnection(); MockClientTransportInfo transportInfo = transports.poll(); transportInfo.listener.transportReady(); ClientTransport mockTransport = transportInfo.transport; when(mockTransport.newStream( any(MethodDescriptor.class), any(Metadata.class), any(CallOptions.class))) .thenReturn(mockStream); when(mockPicker.pickSubchannel(any(PickSubchannelArgs.class))).thenReturn( PickResult.withSubchannel(subchannel, factory2)); helper.updateBalancingState(READY, mockPicker); assertEquals(1, executor.runDueTasks()); verify(mockPicker).pickSubchannel(any(PickSubchannelArgs.class)); verify(mockTransport).newStream(same(method), any(Metadata.class), callOptionsCaptor.capture()); assertEquals( Arrays.asList(factory1, factory2), callOptionsCaptor.getValue().getStreamTracerFactories()); verifyZeroInteractions(factory1); verifyZeroInteractions(factory2); }
@Override public <ReqT, RespT> ClientCall<ReqT, RespT> newCall(MethodDescriptor<ReqT, RespT> method, CallOptions callOptions) { return interceptorChannel.newCall(method, callOptions); }
ManagedChannelImpl extends ManagedChannel implements
    InternalInstrumented<ChannelStats> { @Override public <ReqT, RespT> ClientCall<ReqT, RespT> newCall(MethodDescriptor<ReqT, RespT> method, CallOptions callOptions) { return interceptorChannel.newCall(method, callOptions); } }
ManagedChannelImpl extends ManagedChannel implements
    InternalInstrumented<ChannelStats> { @Override public <ReqT, RespT> ClientCall<ReqT, RespT> newCall(MethodDescriptor<ReqT, RespT> method, CallOptions callOptions) { return interceptorChannel.newCall(method, callOptions); } ManagedChannelImpl(
      AbstractManagedChannelImplBuilder<?> builder,
      ClientTransportFactory clientTransportFactory,
      BackoffPolicy.Provider backoffPolicyProvider,
      ObjectPool<? extends Executor> balancerRpcExecutorPool,
      Supplier<Stopwatch> stopwatchSupplier,
      List<ClientInterceptor> interceptors,
      final TimeProvider timeProvider); }
ManagedChannelImpl extends ManagedChannel implements
    InternalInstrumented<ChannelStats> { @Override public <ReqT, RespT> ClientCall<ReqT, RespT> newCall(MethodDescriptor<ReqT, RespT> method, CallOptions callOptions) { return interceptorChannel.newCall(method, callOptions); } ManagedChannelImpl(
      AbstractManagedChannelImplBuilder<?> builder,
      ClientTransportFactory clientTransportFactory,
      BackoffPolicy.Provider backoffPolicyProvider,
      ObjectPool<? extends Executor> balancerRpcExecutorPool,
      Supplier<Stopwatch> stopwatchSupplier,
      List<ClientInterceptor> interceptors,
      final TimeProvider timeProvider); @Override ListenableFuture<ChannelStats> getStats(); @Override InternalLogId getLogId(); @Override ManagedChannelImpl shutdown(); @Override ManagedChannelImpl shutdownNow(); @Override boolean isShutdown(); @Override boolean awaitTermination(long timeout, TimeUnit unit); @Override boolean isTerminated(); @Override ClientCall<ReqT, RespT> newCall(MethodDescriptor<ReqT, RespT> method,
      CallOptions callOptions); @Override String authority(); @Override ConnectivityState getState(boolean requestConnection); @Override void notifyWhenStateChanged(final ConnectivityState source, final Runnable callback); @Override void resetConnectBackoff(); @Override void enterIdle(); @Override String toString(); @Override Map<String, String> getLoadBalanceModeMap(); @Override void setLoadBalanceModeMap(Map<String, String> map); @Override NameResolver getNameResolver(); @Override LoadBalancer getLoadBalancer(); }
ManagedChannelImpl extends ManagedChannel implements
    InternalInstrumented<ChannelStats> { @Override public <ReqT, RespT> ClientCall<ReqT, RespT> newCall(MethodDescriptor<ReqT, RespT> method, CallOptions callOptions) { return interceptorChannel.newCall(method, callOptions); } ManagedChannelImpl(
      AbstractManagedChannelImplBuilder<?> builder,
      ClientTransportFactory clientTransportFactory,
      BackoffPolicy.Provider backoffPolicyProvider,
      ObjectPool<? extends Executor> balancerRpcExecutorPool,
      Supplier<Stopwatch> stopwatchSupplier,
      List<ClientInterceptor> interceptors,
      final TimeProvider timeProvider); @Override ListenableFuture<ChannelStats> getStats(); @Override InternalLogId getLogId(); @Override ManagedChannelImpl shutdown(); @Override ManagedChannelImpl shutdownNow(); @Override boolean isShutdown(); @Override boolean awaitTermination(long timeout, TimeUnit unit); @Override boolean isTerminated(); @Override ClientCall<ReqT, RespT> newCall(MethodDescriptor<ReqT, RespT> method,
      CallOptions callOptions); @Override String authority(); @Override ConnectivityState getState(boolean requestConnection); @Override void notifyWhenStateChanged(final ConnectivityState source, final Runnable callback); @Override void resetConnectBackoff(); @Override void enterIdle(); @Override String toString(); @Override Map<String, String> getLoadBalanceModeMap(); @Override void setLoadBalanceModeMap(Map<String, String> map); @Override NameResolver getNameResolver(); @Override LoadBalancer getLoadBalancer();  }