@Test public void callOptionsExecutor() { Metadata headers = new Metadata(); ClientStream mockStream = mock(ClientStream.class); when(mockTransport.newStream(same(method), same(headers))).thenReturn(mockStream); FakeClock fakeExecutor = new FakeClock(); ManagedChannel channel = createChannel( new FakeNameResolverFactory(true), NO_INTERCEPTOR); ClientCall<String, Integer> call = channel.newCall(method, CallOptions.DEFAULT.withExecutor( fakeExecutor.scheduledExecutorService)); call.start(mockCallListener, headers); verify(mockTransport, timeout(1000)).start(transportListenerCaptor.capture()); transportListenerCaptor.getValue().transportReady(); verify(mockTransport, timeout(1000)).newStream(same(method), same(headers)); verify(mockStream, timeout(1000)).start(streamListenerCaptor.capture()); ClientStreamListener streamListener = streamListenerCaptor.getValue(); Metadata trailers = new Metadata(); assertEquals(0, fakeExecutor.numPendingTasks()); streamListener.closed(Status.CANCELLED, trailers); verify(mockCallListener, never()).onClose(same(Status.CANCELLED), same(trailers)); assertEquals(1, fakeExecutor.runDueTasks()); verify(mockCallListener).onClose(same(Status.CANCELLED), same(trailers)); }
@Override public <ReqT, RespT> ClientCall<ReqT, RespT> newCall(MethodDescriptor<ReqT, RespT> method, CallOptions callOptions) { return interceptorChannel.newCall(method, callOptions); }
ManagedChannelImpl extends ManagedChannel implements WithLogId { @Override public <ReqT, RespT> ClientCall<ReqT, RespT> newCall(MethodDescriptor<ReqT, RespT> method, CallOptions callOptions) { return interceptorChannel.newCall(method, callOptions); } }
ManagedChannelImpl extends ManagedChannel implements WithLogId { @Override public <ReqT, RespT> ClientCall<ReqT, RespT> newCall(MethodDescriptor<ReqT, RespT> method, CallOptions callOptions) { return interceptorChannel.newCall(method, callOptions); } ManagedChannelImpl(String target, BackoffPolicy.Provider backoffPolicyProvider,
      NameResolver.Factory nameResolverFactory, Attributes nameResolverParams,
      LoadBalancer.Factory loadBalancerFactory, ClientTransportFactory transportFactory,
      DecompressorRegistry decompressorRegistry, CompressorRegistry compressorRegistry,
      @Nullable Executor executor, @Nullable String userAgent,
      List<ClientInterceptor> interceptors); }
ManagedChannelImpl extends ManagedChannel implements WithLogId { @Override public <ReqT, RespT> ClientCall<ReqT, RespT> newCall(MethodDescriptor<ReqT, RespT> method, CallOptions callOptions) { return interceptorChannel.newCall(method, callOptions); } ManagedChannelImpl(String target, BackoffPolicy.Provider backoffPolicyProvider,
      NameResolver.Factory nameResolverFactory, Attributes nameResolverParams,
      LoadBalancer.Factory loadBalancerFactory, ClientTransportFactory transportFactory,
      DecompressorRegistry decompressorRegistry, CompressorRegistry compressorRegistry,
      @Nullable Executor executor, @Nullable String userAgent,
      List<ClientInterceptor> interceptors); @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 String getLogId(); }
ManagedChannelImpl extends ManagedChannel implements WithLogId { @Override public <ReqT, RespT> ClientCall<ReqT, RespT> newCall(MethodDescriptor<ReqT, RespT> method, CallOptions callOptions) { return interceptorChannel.newCall(method, callOptions); } ManagedChannelImpl(String target, BackoffPolicy.Provider backoffPolicyProvider,
      NameResolver.Factory nameResolverFactory, Attributes nameResolverParams,
      LoadBalancer.Factory loadBalancerFactory, ClientTransportFactory transportFactory,
      DecompressorRegistry decompressorRegistry, CompressorRegistry compressorRegistry,
      @Nullable Executor executor, @Nullable String userAgent,
      List<ClientInterceptor> interceptors); @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 String getLogId();  }