public void testProxyAuthWithWrongPassword() throws Exception {
Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
Attr uri = doc.createAttribute("URI");
uri.setNodeValue(url);
ResolverDirectHTTP resolverDirectHTTP = new ResolverDirectHTTP();
resolverDirectHTTP.engineSetProperty("http.proxy.host",proxyHost);
resolverDirectHTTP.engineSetProperty("http.proxy.port", proxyPort);
resolverDirectHTTP.engineSetProperty("http.proxy.username", proxyUsername);
resolverDirectHTTP.engineSetProperty("http.proxy.password", "wrongPassword");
ResourceResolverContext context =
new ResourceResolverContext(uri, url, true);
try {
resolverDirectHTTP.engineResolveURI(context);
Assert.fail("Expected ResourceResolverException");
} catch (ResourceResolverException e) {
Assert.assertEquals("Server returned HTTP response code: 407 for URL: " + url, e.getMessage());
}
}