List of usage examples for org.apache.http.impl.conn CPoolProxy newProxy
public static HttpClientConnection newProxy(final CPoolEntry poolEntry)
From source file:org.apache.http.impl.conn.PoolingHttpClientConnectionManager.java
protected HttpClientConnection leaseConnection(final Future<CPoolEntry> future, final long timeout, final TimeUnit tunit) throws InterruptedException, ExecutionException, ConnectionPoolTimeoutException { final CPoolEntry entry; try {/* w w w .j a va 2s . c o m*/ entry = future.get(timeout, tunit); if (entry == null || future.isCancelled()) { throw new InterruptedException(); } Asserts.check(entry.getConnection() != null, "Pool entry with no connection"); if (this.log.isDebugEnabled()) { this.log.debug("Connection leased: " + format(entry) + formatStats(entry.getRoute())); } return CPoolProxy.newProxy(entry); } catch (final TimeoutException ex) { throw new ConnectionPoolTimeoutException("Timeout waiting for connection from pool"); } }