Using ProxySelector to allow users to configure the proxy

Jean-Christophe Collet Jean-Christophe.Collet at Sun.COM
Mon May 4 05:16:08 PDT 2009


Paulo Levi wrote:
> Anyone read the first message at all? The problem is that other proxy 
> requests are effectively ignored after a DIRECT connection even if it 
> fails.
>
> What i am trying right now is implementing ProxySelector so that a 
> "manual" proxy configuration is added at the end of the
> public List<Proxy> select(final URI uri) 
> return list, and only requesting configuration from the user if    
> public void connectFailed(final URI uri, final SocketAddress sa, final 
> IOException ioe)
> function is called.
>
> Obviously this won't work how the current setup is done. What is so 
> special about direct connection requests that they must break the 
> proxy chain of responsibility?
That's because DIRECT means "do not use a proxy" and 
ProxySelector.connectFailed() is only called when a connection to a 
proxy failed so that it can, potentially, be removed from the list of 
available proxies.
Since no proxy connection was attempted, the callback is not triggered 
even if the connection failed.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: jean-christophe_collet.vcf
Type: text/x-vcard
Size: 246 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/net-dev/attachments/20090504/cf15abd3/jean-christophe_collet.vcf 


More information about the net-dev mailing list