HttpHandler extends LoggingRequestHandler { protected static Duration getRequestTimeout(HttpRequest request, Duration defaultTimeout) { if ( ! request.hasProperty("timeout")) { return defaultTimeout; } try { return Duration.ofMillis((long) (Double.parseDouble(request.getProperty("timeout")) * 1000)); } catch (Exception e) { return defaultTimeout; } } HttpHandler(HttpHandler.Context ctx); @Override HttpResponse handle(HttpRequest request);  }
@Test public void testTimeoutParameter() { assertEquals(1500, HttpTestHandler.getRequestTimeout( HttpRequest.createTestRequest("foo", com.yahoo.jdisc.http.HttpRequest.Method.GET, null, Collections.singletonMap("timeout", "1.5")), Duration.ofSeconds(5)).toMillis()); }