I\'ve been trying to configure the user and password for proxy authentication from the configured properties while using Apaches HttpComponent\'s httpclient, but with no suc
If you have to keep your code working with 4.1 or want to use the below snippet, it's important to know that httpclient 4.1 will not send the authentication to proxy. You will probably get a 407 "Proxy Authentication Required" status code. I upgraded to 4.3.3 and all worked well, although DefaultHttpClient and ConnRoutePNames were deprecated in this release. Hope this helps!
DefaultHttpClient httpclient = new DefaultHttpClient();
httpclient.getCredentialsProvider().setCredentials(
new AuthScope("PROXY HOST", 8080),
new UsernamePasswordCredentials("username", "password"));
HttpHost proxy = new HttpHost("PROXY HOST", 8080);
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);