DefaultClientRequestContext extends NonWrappingRequestContext implements ClientRequestContext { @Override public void setResponseTimeoutMillis(TimeoutMode mode, long responseTimeoutMillis) { responseTimeoutScheduler.setTimeoutNanos(requireNonNull(mode, "mode"), TimeUnit.MILLISECONDS.toNanos(responseTimeoutMillis)); } DefaultClientRequestContext(
            EventLoop eventLoop, MeterRegistry meterRegistry, SessionProtocol sessionProtocol,
            RequestId id, HttpMethod method, String path, @Nullable String query, @Nullable String fragment,
            ClientOptions options, @Nullable HttpRequest req, @Nullable RpcRequest rpcReq,
            TimeoutScheduler responseTimeoutScheduler,
            long requestStartTimeNanos, long requestStartTimeMicros);  DefaultClientRequestContext(
            MeterRegistry meterRegistry, SessionProtocol sessionProtocol,
            RequestId id, HttpMethod method, String path, @Nullable String query, @Nullable String fragment,
            ClientOptions options, @Nullable HttpRequest req, @Nullable RpcRequest rpcReq,
            long requestStartTimeNanos, long requestStartTimeMicros); private  DefaultClientRequestContext(
            @Nullable EventLoop eventLoop, MeterRegistry meterRegistry,
            SessionProtocol sessionProtocol, RequestId id, HttpMethod method, String path,
            @Nullable String query, @Nullable String fragment, ClientOptions options,
            @Nullable HttpRequest req, @Nullable RpcRequest rpcReq,
            @Nullable ServiceRequestContext root, @Nullable TimeoutScheduler responseTimeoutScheduler,
            long requestStartTimeNanos, long requestStartTimeMicros); private  DefaultClientRequestContext(DefaultClientRequestContext ctx,
                                        RequestId id,
                                        @Nullable HttpRequest req,
                                        @Nullable RpcRequest rpcReq,
                                        @Nullable Endpoint endpoint); CompletableFuture<Boolean> init(EndpointGroup endpointGroup); @Nullable @Override ServiceRequestContext root(); @Override ClientRequestContext newDerivedContext(RequestId id,
                                                  @Nullable HttpRequest req,
                                                  @Nullable RpcRequest rpcReq,
                                                  @Nullable Endpoint endpoint); @Override ContextAwareEventLoop eventLoop(); @Override ByteBufAllocator alloc(); @Nullable @Override SSLSession sslSession(); @Override ClientOptions options(); @Override EndpointGroup endpointGroup(); @Override Endpoint endpoint(); @Override @Nullable String fragment(); @Override long writeTimeoutMillis(); @Override void setWriteTimeoutMillis(long writeTimeoutMillis); @Override void setWriteTimeout(Duration writeTimeout); @Override long responseTimeoutMillis(); @Override void clearResponseTimeout(); @Override void setResponseTimeoutMillis(TimeoutMode mode, long responseTimeoutMillis); @Override void setResponseTimeout(TimeoutMode mode, Duration responseTimeout); @Override long maxResponseLength(); @Override void setMaxResponseLength(long maxResponseLength); @Override HttpHeaders additionalRequestHeaders(); @Override void setAdditionalRequestHeader(CharSequence name, Object value); @Override void addAdditionalRequestHeader(CharSequence name, Object value); @Override void mutateAdditionalRequestHeaders(Consumer<HttpHeadersBuilder> mutator); @Override RequestLogAccess log(); @Override RequestLogBuilder logBuilder(); @Override void timeoutNow(); @Override boolean isTimedOut(); @Override CompletableFuture<Void> whenResponseTimingOut(); @Override CompletableFuture<Void> whenResponseTimedOut(); @Override String toString();  }
@Test void setResponseTimeoutAfterWithNonPositive() { final HttpRequest req = HttpRequest.of(HttpMethod.GET, "/"); final ClientRequestContext ctx = ClientRequestContext.of(req); assertThatThrownBy(() -> ctx.setResponseTimeoutMillis(TimeoutMode.SET_FROM_NOW, 0)) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("(expected: > 0)"); assertThatThrownBy(() -> ctx.setResponseTimeoutMillis(TimeoutMode.SET_FROM_NOW, -10)) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("(expected: > 0)"); }