GrpcCallContext implements ApiCallContext { @Override public GrpcCallContext withTimeout(@Nullable Duration timeout) { if (timeout != null && (timeout.isZero() || timeout.isNegative())) { timeout = null; } if (timeout != null && this.timeout != null && this.timeout.compareTo(timeout) <= 0) { return this; } return new GrpcCallContext( this.channel, this.callOptions, timeout, this.streamWaitTimeout, this.streamIdleTimeout, this.channelAffinity, this.extraHeaders); } private  GrpcCallContext(
      Channel channel,
      CallOptions callOptions,
      @Nullable Duration timeout,
      @Nullable Duration streamWaitTimeout,
      @Nullable Duration streamIdleTimeout,
      @Nullable Integer channelAffinity,
      ImmutableMap<String, List<String>> extraHeaders); static GrpcCallContext createDefault(); static GrpcCallContext of(Channel channel, CallOptions callOptions); @Override GrpcCallContext nullToSelf(ApiCallContext inputContext); @Override GrpcCallContext withCredentials(Credentials newCredentials); @Override GrpcCallContext withTransportChannel(TransportChannel inputChannel); @Override GrpcCallContext withTimeout(@Nullable Duration timeout); @Nullable @Override Duration getTimeout(); @Override GrpcCallContext withStreamWaitTimeout(@Nullable Duration streamWaitTimeout); @Override GrpcCallContext withStreamIdleTimeout(@Nullable Duration streamIdleTimeout); @BetaApi("The surface for channel affinity is not stable yet and may change in the future.") GrpcCallContext withChannelAffinity(@Nullable Integer affinity); @BetaApi("The surface for extra headers is not stable yet and may change in the future.") @Override GrpcCallContext withExtraHeaders(Map<String, List<String>> extraHeaders); @Override ApiCallContext merge(ApiCallContext inputCallContext); Channel getChannel(); CallOptions getCallOptions(); @BetaApi("The surface for streaming is not stable yet and may change in the future.") @Nullable Duration getStreamWaitTimeout(); @BetaApi("The surface for streaming is not stable yet and may change in the future.") @Nullable Duration getStreamIdleTimeout(); @BetaApi("The surface for channel affinity is not stable yet and may change in the future.") @Nullable Integer getChannelAffinity(); @BetaApi("The surface for extra headers is not stable yet and may change in the future.") @Override Map<String, List<String>> getExtraHeaders(); GrpcCallContext withChannel(Channel newChannel); GrpcCallContext withCallOptions(CallOptions newCallOptions); GrpcCallContext withRequestParamsDynamicHeaderOption(String requestParams); @Override @Nonnull ApiTracer getTracer(); @Override GrpcCallContext withTracer(@Nonnull ApiTracer tracer); @Override int hashCode(); @Override boolean equals(Object o);  }
@Test public void testWithTimeout() { Truth.assertThat(GrpcCallContext.createDefault().withTimeout(null).getTimeout()).isNull(); }