schemeRegistry.register(new Scheme("https", 443, sslSocketFactory));
httpClientConnMgr = new ThreadSafeClientConnManager(schemeRegistry) {
@Override
public ClientConnectionRequest requestConnection(HttpRoute route, Object state) {
final ClientConnectionRequest wrapped = super.requestConnection(route, state);
return new ClientConnectionRequest() {
@Override
public ManagedClientConnection getConnection(long timeout, TimeUnit tunit) throws InterruptedException, ConnectionPoolTimeoutException {
Date start = new Date();
try {
return wrapped.getConnection(timeout, tunit);
} finally {
RequestInfo.get().blocked(start, new Date());
}
}
@Override
public void abortRequest() {
wrapped.abortRequest();
}
};
}
};