* so need to ensure that any items used in its equals/hashcode methods are
* not changed after use, i.e.:
* host, port, protocol, localAddress, proxy
*
*/
HostConfiguration hc = new HostConfiguration();
hc.setHost(host, port, protocol); // All needed to ensure re-usablility
// Set up the local address if one exists
if (localAddress != null){
hc.setLocalAddress(localAddress);
}
boolean useProxy = PROXY_DEFINED && !isNonProxy(host);
if (useProxy) {
if (log.isDebugEnabled()){
log.debug("Setting proxy: "+PROXY_HOST+":"+PROXY_PORT);
}
hc.setProxy(PROXY_HOST, PROXY_PORT);
}
Map map = (Map) httpClients.get();
HttpClient httpClient = (HttpClient) map.get(hc);