On Wed, 2011-01-12 at 14:07 -0500, David Motes wrote:
> After spending too much time on ProxySelectorRoutePlanner, here is
> what I have discovered.
> 
> Note this is for a Java application not an applet.
> 
>  If you do not use System.setProperty("java.net.useSystemProxies",
> "true"); in your program Java will NOT use a proxy no matter how it is
> configured.
>  I used the Java control panel to set it to use browser settings and
> when that did not work I set the proxy config in the Java control
> panel.
>  This code > DefaultHttpClient httpclient = new DefaultHttpClient();
> > ProxySelectorRoutePlanner routePlanner = new ProxySelectorRoutePlanner(
> >         httpclient.getConnectionManager().getSchemeRegistry(),
> >         ProxySelector.getDefault());
> > httpclient.setRoutePlanner(routePlanner);
>  makes no difference either.
> 
> If you use System.setProperty("java.net.useSystemProxies", "true"); in
> your program here is what happens.
> If the Java control panel is set to use browser settings it gets the
> proxy settings from the browser. Yeah!
> If the Java control panel is set to use proxy config in the control
> panel is uses that.
> 
> The code that loads icons from a server or uses HTMLEditorKit USES the
> proxy and works fine.
> 
> Code that uses HTTPClient ends up getting hung up because the low
> level tcp code tries to use a SOCKS proxy not an HTTP proxy.

This might be a configuration issue.

> It connects to the HTTP proxy, sends some kind of request, and waits
> FOREVER for the reply from what it thinks is a  socks proxy.
> 
> Why does the HTMLEditorKit work the way it is supposed to and the
> HTTPClient does not?
> I would think that eventually they would both get down to the same
> Java tcp code.
> 

I double-checked ProxySelectorRoutePlanner code to make sure it
explicitly checked the type of proxy entries and selected HTTP proxies
only. 

> I would be willing to look at this some more if anyone has any suggestion.
> 

Make a copy of the ProxySelectorRoutePlanner class and add additional
debug logs to capture detailed proxy entries returned by the
ProxySelector

Hope this helps

Oleg



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to