-
January 16th, 2013, 07:30 AM
#1
Help: Proxy authentication and multiple proxies connection
Hi
I hope someone can put some clarification on this problem that I'm having.
I am using Apache HTTPClient 4.2 library and I use proxies to connect to internet.
For normal proxies I don't have any problem and it goes through the proxy but I'm not sure how this works when the proxy requires an authentication.
Can someone tell the implementation required to authenticate the proxy via username and pass(which I have) and then connect via proxy to the internet?
In addition, is it possible to connect to multiple proxies? for example,assume that I want to connect to one proxy and then use that proxy to connect to another which then will connect to internet, is this achievable in Java using httpclient?
Any link containing guides,tutorial are welcome too
Thank you
-
January 17th, 2013, 05:06 AM
#2
Re: Help: Proxy authentication and multiple proxies connection
Try this... I guess this could work...
Code:
HttpClient httpClient = new HttpClient();
HostConfiguration config = client.getHostConfiguration();
config.setProxy(proxyUrl, proxyPort);
Credentials credentials = new UsernamePasswordCredentials(proxyUser, proxyPasswd);
AuthScope authScope = new AuthScope(proxyUrl, proxyPort);
client.getState().setProxyCredentials(authScope, credentials);
You can also have a look at proxy authentication example in httpclient examples section.
What do you mean by multiple proxies? At once? As far as I know it is not possible.
You can only connect through one proxy. It could be possible that such proxy usea another proxy, but it is not your responsibility.
Last edited by AlbertGM; January 17th, 2013 at 05:09 AM.
Please, correct me. I'm just learning.... and sorry for my english :-)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|