tommiionfire / proxy-vole

Automatically exported from code.google.com/p/proxy-vole
0 stars 0 forks source link

Apache Httpclient 4 - not reading proxy settings from proxy-vole #56

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Configure a working proxy with proxy-vole
2. Access an url behind a proxy with sucess
3. Create a httpclient client and read the same url

What is the expected output? What do you see instead?
httpclient does not see proxy-vole settings reflected

What version of the product are you using? On what operating system?
latest on windows and linux

Please provide any additional information below.

Original issue reported on code.google.com by pgh.nu...@gmail.com on 29 Jan 2015 at 9:12

GoogleCodeExporter commented 9 years ago
Hi,
Proxy vole does only work with the standard Java network stack and http client 
out of the box.
For the Apache hhtpclient you need to use a different approach like this:

ProxySearch proxySearch = ProxySearch.getDefaultProxySearch();
ProxySelector myProxySelector = proxySearch.getProxySelector();

SystemDefaultRoutePlanner routePlanner = new SystemDefaultRoutePlanner(
        myProxySelector);
CloseableHttpClient httpclient = HttpClients.custom()
        .setRoutePlanner(routePlanner)
        .build();

See also 
http://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html#d5e475

Have fun,
- Rossi

Original comment by rosstaus...@googlemail.com on 9 Feb 2015 at 8:45

GoogleCodeExporter commented 9 years ago
Great! Thank you Rossi.

Pedro Nunes

Original comment by pgh.nu...@gmail.com on 21 Feb 2015 at 10:56