On Fri, 2012-04-13 at 20:43 +0800, 董玉冰 Tom Yubing Dong wrote:
> Hi,
>
> I have implemented my own ProxySelector, so that when connection
> fails, connectFailed is called and the proxy can be suspended or
> removed from the list.
>
> I used my ProxySelector implementation to construct a
> ProxySelectorRoutePlanner, and set it to be the RoutePlanner of a
> DefaultHttpClient.
>
> I let ProxySelector.select return an invalid proxy (like
> "localhost:1234"). When I call HttpClient.execute, a
> HttpHostConnectException("Connection to http://127.0.0.1:1234
> refused") is thrown as expected, but ProxySelector.connectFailed never
> get called.
>
Hi Tom
The problem is that currently route planners cannot track proxy connect
failures. There is already an improvement request for that. The problem
is that the HttpRoutePlanner interface will have to be deprecated and
replaced with something more complex, which may take some time.
https://issues.apache.org/jira/browse/HTTPCLIENT-1176
> I wish to ask what else do I need to do? Do I need to implement a
> HttpRequestRetryHandler that calls ProxySelector.connectFailed?
>
Yes, that sounds like the only feasible workaround for the time being.
Hope this helps
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]