@Test
public void testBasicAuthException() throws Exception {

	startWithHandler(new AbstractHandler() {
		@Override
		public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
			baseRequest.setHandled(true);
			response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
		}
	});
	final String url = "http://user:pass@localhost:" + getPort() + "/foo?bar=baz";
	final String urlWithoutAuth = "http://localhost:" + getPort() + "/foo?bar=baz";
	httpClient.send(HttpRequestBuilder.<Integer>forUrl(url)
			.successHandler((httpRequest, is, statusCode, e) -> {
				fail();
				return null;
			})
			.errorHandler((httpRequest, is, statusCode, e) -> {
				assertThat(statusCode).isEqualTo(401);
				assertThat(e.getMessage())
						.doesNotContain(url)
						.contains(urlWithoutAuth);
				return null;
			})
			.build());
}