Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
5.0
-
OS: Windows 10
JRE: AdoptOpenJdk v11
Proxy type: NTLM (Wingate)
Description
Running this:
try (CloseableHttpClient httpClient = WinHttpClients.createDefault()) { HttpHost target = HttpHost.create("http://example.com"); HttpHost proxy = new HttpHost("http", "localhost", 80); RequestConfig config = RequestConfig.custom().setProxy(proxy).build(); HttpGet request = new HttpGet("/"); request.setConfig(config); try (CloseableHttpResponse response = httpClient.execute(target, request)) { StatusLine statusLine = new StatusLine(response); if (statusLine.getStatusCode() == HttpStatus.SC_OK) { System.out.println("Test OK"); } else if (statusLine.getStatusCode() == HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED) { throw new CredentialException(statusLine.getReasonPhrase()); } } } catch (Exception e) { e.printStackTrace(); }
I get an error. See the attached log file. The same code works with Http Client v 4.5.12