ProxySearch.getDefaultProxySearch() uses JAVA-Strategy which does sets up a ProtocolDispatchSelector without any delegates
GoogleCodeExporter opened this issue · comments
ProxySearch.getDefaultProxySearch() uses JAVA as first strategy, however on my
machine, this strategy does not work at all.
What steps will reproduce the problem?
ProxySearch proxySearch = ProxySearch.getDefaultProxySearch();
ProxySelector myProxySelector = proxySearch.getProxySelector();
ProxySelector.setDefault(myProxySelector); // adapt global proxy selector
List<Proxy> proxies = myProxySelector.select(new URI("http://www.google.com"));
System.out.println("\n" + proxies.size() + " proxies found via ProxySelector " + myProxySelector.getClass());
for (Proxy proxy : proxies) {
System.out.println(proxy.toString());
}
Output is:
TRACE: Detecting platform. Name is: Windows 7
TRACE: Detected Windows platform: Windows 7
TRACE: Detected Browser is InternetExplorer
TRACE: Using default search priority: Proxy search:
com.btr.proxy.search.java.JavaProxySearchStrategy@83cc67
com.btr.proxy.search.browser.ie.IEProxySearchStrategy@e09713
com.btr.proxy.search.desktop.DesktopProxySearchStrategy@de6f34
com.btr.proxy.search.env.EnvProxySearchStrategy@156ee8e
TRACE: Executing search strategies to find proxy selector
TRACE: Using settings from Java System Properties
1 proxies found via ProxySelector class
com.btr.proxy.selector.misc.ProtocolDispatchSelector
DIRECT
If I use OS_DEFAULT strategy or BROWSER strategy, it works fine:
ProxySearch proxySearch = new ProxySearch();
proxySearch.addStrategy(Strategy.OS_DEFAULT);
Output is:
TRACE: Executing search strategies to find proxy selector
TRACE: Detecting platform. Name is: Windows 7
TRACE: Detected Windows platform: Windows 7
TRACE: Detecting platform. Name is: Windows 7
TRACE: Detected Windows platform: Windows 7
TRACE: Detected Windows desktop
TRACE: Detecting system settings.
TRACE: We are running on Windows.
TRACE: Detecting IE proxy settings
TRACE: Autodetecting script URL.
TRACE: IE uses script: http://x.x.x.x/wpad.dat
INFO: Using javax.script JavaScript engine.
3 proxies found via ProxySelector class
com.btr.proxy.selector.misc.ProxyListFallbackSelector
HTTP @ ...
I think instead of using an empty ProtocolDispatchSelector, the JAVA strategy
should detect that no java settings are there and it should then use OS_DEFAULT
or BROWSER instead.
Original issue reported on code.google.com by Dominik....@gmail.com
on 27 Jul 2012 at 11:07
Hi
Finally I found the time to fix this issue in the new release: proxy-vole
20120905
It was releated to Bug 27 and caused by a change in the JavaProxySearch that
was always used even if no system property was set.
The new release should fix this. Please download that one and test it.
Have fun,
- Rossi
Original comment by rosstaus...@googlemail.com
on 5 Sep 2012 at 9:51
- Changed state: Fixed
Hi,
Yes I know that the default proxy search using Java first is not optimal for
all scenarios. This is there because it is defensive to do it like this.
The problem is that I cannot find out if there should be really no proxy
(DIRECT internet connection) or if the user has just not set the Java Proxy
settings. In both cases the dispatcher is empty.
To work around this you can set in your application the OS_DEFAULT strategy
that will be better for many use cases.
I will think about it if I will change the default settings to match the
OS_DEFAULT in the future.
Have fun,
- Rossi
Original comment by rosstaus...@googlemail.com
on 27 Jul 2012 at 9:28
- Changed state: Accepted
Thanks for the comment, maybe you can at least update the usage examples at
http://code.google.com/p/proxy-vole/wiki/UsageExamples to make users aware of
this.
Original comment by Dominik....@gmail.com
on 28 Jul 2012 at 4:17
Hi,
Yes I will try to update at least the docu and I will experiment a little bit
with changing the default strategies and the fallback logic.
I think about an active connection detection mode where I try to reach a test
url like for example www.google.com and then try one strategy after the other
until I'm successful.
But this will need some changes and I'm a little bit short on time (other
projects are more interesting at the moment :-)
Thanks for all your input.
- Rossi
Original comment by rosstaus...@googlemail.com
on 28 Jul 2012 at 7:18