MCPcopy Index your code
hub / github.com/HtmlUnit/htmlunit / timeout

Method timeout

src/test/java/org/htmlunit/WebClient4Test.java:324–344  ·  view source on GitHub ↗

@throws Exception if an error occurs

()

Source from the content-addressed store, hash-verified

322 * @throws Exception if an error occurs
323 */
324 @Test
325 public void timeout() throws Exception {
326 final Map<String, Class<? extends Servlet>> servlets = new HashMap<>();
327 servlets.put("/*", DelayDeliverServlet.class);
328 startWebServer("./", servlets);
329
330 final WebClient client = getWebClient();
331 client.getOptions().setTimeout(500);
332
333 try {
334 client.getPage(URL_FIRST);
335 fail("timeout expected!");
336 }
337 catch (final SocketTimeoutException e) {
338 // as expected
339 }
340
341 // now configure higher timeout allowing to get the page
342 client.getOptions().setTimeout(5000);
343 client.getPage(URL_FIRST);
344 }
345
346 /**
347 * Make sure cookies set for the request are overwriting the cookieManager.

Callers 14

security.jsFile · 0.45
security.jsFile · 0.45
security.jsFile · 0.45
security.jsFile · 0.45
security.jsFile · 0.45
hx-push-url.jsFile · 0.45
security.jsFile · 0.45
hx-push-url.jsFile · 0.45
security.jsFile · 0.45
security.jsFile · 0.45
hx-push-url.jsFile · 0.45
security.jsFile · 0.45

Calls 6

getOptionsMethod · 0.95
getPageMethod · 0.95
getWebClientMethod · 0.65
putMethod · 0.45
startWebServerMethod · 0.45
setTimeoutMethod · 0.45

Tested by

no test coverage detected