Dear Oleg, Thanks a lot for your reply. I look forward to future versions that can really fix this.
I found that implementing a HttpRequestRetryHandler doesn't seem to be a valid workaround, since I couldn't find proxy information in the HttpContext object passed to retryRequest(), which means that I can't figure out which proxies are failing. I am planning to create for each proxy in my proxy list an HttpClient, and manually manage this list of HttpClient's. --- Cheers, Tom 在 2012年4月14日 上午3:00,Oleg Kalnichevski <[email protected]> 写道: > 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] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
