DefaultServiceRequestContext extends NonWrappingRequestContext implements ServiceRequestContext { @Override public void setRequestTimeoutMillis(TimeoutMode mode, long requestTimeoutMillis) { requestTimeoutScheduler.setTimeoutNanos(requireNonNull(mode, "mode"), TimeUnit.MILLISECONDS.toNanos(requestTimeoutMillis)); } DefaultServiceRequestContext(
            ServiceConfig cfg, Channel ch, MeterRegistry meterRegistry, SessionProtocol sessionProtocol,
            RequestId id, RoutingContext routingContext, RoutingResult routingResult, HttpRequest req,
            @Nullable SSLSession sslSession, ProxiedAddresses proxiedAddresses, InetAddress clientAddress,
            long requestStartTimeNanos, long requestStartTimeMicros);   DefaultServiceRequestContext(
            ServiceConfig cfg, Channel ch, MeterRegistry meterRegistry, SessionProtocol sessionProtocol,
            RequestId id, RoutingContext routingContext, RoutingResult routingResult, HttpRequest req,
            @Nullable SSLSession sslSession, ProxiedAddresses proxiedAddresses, InetAddress clientAddress,
            @Nullable TimeoutScheduler requestTimeoutScheduler,
            long requestStartTimeNanos, long requestStartTimeMicros,
            HttpHeaders additionalResponseHeaders, HttpHeaders additionalResponseTrailers); @Nullable @Override V attr(AttributeKey<V> key); @Override Iterator<Entry<AttributeKey<?>, Object>> attrs(); @Nonnull @Override A remoteAddress(); @Nonnull @Override A localAddress(); @Override InetAddress clientAddress(); @Override ServiceConfig config(); @Override RoutingContext routingContext(); @Override Map<String, String> pathParams(); @Override ContextAwareScheduledExecutorService blockingTaskExecutor(); @Override String mappedPath(); @Override String decodedMappedPath(); @Nullable @Override MediaType negotiatedResponseMediaType(); @Override ContextAwareEventLoop eventLoop(); @Override ByteBufAllocator alloc(); @Nullable @Override SSLSession sslSession(); @Override long requestTimeoutMillis(); @Override void clearRequestTimeout(); @Override void setRequestTimeoutMillis(TimeoutMode mode, long requestTimeoutMillis); @Override void setRequestTimeout(TimeoutMode mode, Duration requestTimeout); @Override void timeoutNow(); @Override boolean isTimedOut(); @Override CompletableFuture<Void> whenRequestTimingOut(); @Override CompletableFuture<Void> whenRequestTimedOut(); @Override long maxRequestLength(); @Override void setMaxRequestLength(long maxRequestLength); @Override HttpHeaders additionalResponseHeaders(); @Override void setAdditionalResponseHeader(CharSequence name, Object value); @Override void addAdditionalResponseHeader(CharSequence name, Object value); @Override void mutateAdditionalResponseHeaders(Consumer<HttpHeadersBuilder> mutator); @Override HttpHeaders additionalResponseTrailers(); @Override void setAdditionalResponseTrailer(CharSequence name, Object value); @Override void addAdditionalResponseTrailer(CharSequence name, Object value); @Override void mutateAdditionalResponseTrailers(Consumer<HttpHeadersBuilder> mutator); @Override ProxiedAddresses proxiedAddresses(); @Override RequestLogAccess log(); @Override RequestLogBuilder logBuilder(); @Override String toString();  }
@Test void setRequestTimeoutAfterWithNonPositive() { final HttpRequest req = HttpRequest.of(HttpMethod.GET, "/"); final DefaultServiceRequestContext ctx = (DefaultServiceRequestContext) ServiceRequestContext.of(req); assertThatThrownBy(() -> ctx.setRequestTimeoutMillis(TimeoutMode.SET_FROM_NOW, 0)) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("(expected: > 0)"); assertThatThrownBy(() -> ctx.setRequestTimeoutMillis(TimeoutMode.SET_FROM_NOW, -10)) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("(expected: > 0)"); }