It is necessary in the application to implement the ability to work with the network through a proxy server.
I use proxy private, with login and password authorization.
By learning Google could write to such a code
public void proxy_test_auth2() throws IOException { String ntUsername = "a*"; String ntPassword = "***"; String localMachineName = System.getenv("COMPUTERNAME"); String domainName = System.getenv("USERDOMAIN"); String proxyHost = "37.143.11.127"; int proxyPort = 65233; NTCredentials ntCreds = new NTCredentials(ntUsername, ntPassword, localMachineName, domainName); CredentialsProvider credsProvider = new BasicCredentialsProvider(); credsProvider.setCredentials( new AuthScope(proxyHost,proxyPort), ntCreds ); CloseableHttpClient httpclient = HttpClients.custom() .setDefaultCredentialsProvider(credsProvider) .setProxy(new HttpHost(proxyHost, proxyPort)) .setProxyAuthenticationStrategy(new ProxyAuthenticationStrategy()) .build(); try { HttpGet httpget = new HttpGet("http://control456.ru/sample/save_post_get.php"); System.out.println("Executing request " + httpget.getRequestLine()); // Pass local context as a parameter CloseableHttpResponse response = httpclient.execute(httpget); System.out.println(response.getStatusLine().toString()); try { System.out.println("----------------------------------------"); System.out.println(response.getStatusLine()); } finally { response.close(); } } finally { httpclient.close(); } } But in return, I get this error
HTTP/1.0 407 Proxy Authentication Required Unfortunately, I can’t figure it out myself, because Not strong in English, but almost all the information about the Apache HTTP Client on it. I suspect that the error is elementary. I would be very grateful to everyone who responded.