I am using PoolingHttpClientConnectionManager to create connections. I would 
like to get what IP address my connections resolve to. Is there a API that I 
can use.
I need it for reporting and also to drop connections if I think connected IP is 
not the best IP address. I found this 
https://issues.apache.org/jira/browse/HTTPCLIENT-656  

Summary of my code,
PoolingHttpClientConnectionManager connMgr = new 
PoolingHttpClientConnectionManager(socketFactoryRegistry);        ....// build 
custom http client . ...        Set<HttpRoute> hosts = connMgr.getRoutes();     
   for (HttpRoute r: hosts) {            InetAddress ip = 
r.getTargetHost().getAddress();            break;        }
The above code gets an IP only if HttpHost was created using IP in constructor 
. From documentation of  HttpHost.getAddress() Returns the inet address if 
explicitly set by a constructor, null otherwise.



  

Reply via email to