@Test
public void ioException() {

    String wrongUrl = "http://0.0.0.2:80";
    DelegatingAuthenticator authenticator = new DelegatingAuthenticator("jolokia",wrongUrl,null,false);
    HttpExchange exchange = createHttpExchange(new Headers());
    Authenticator.Result result = authenticator.authenticate(exchange);
    Authenticator.Failure failure = (Authenticator.Failure) result;
    assertEquals(failure.getResponseCode(),503);
    String error = exchange.getResponseHeaders().getFirst("X-Error-Details");
    assertTrue(error.contains("http://0.0.0.2:80"));
}