}
}
final RequestConfig config = context.getRequestConfig();
HttpClientConnection managedConn;
try {
final int timeout = config.getConnectionRequestTimeout();
managedConn = connRequest.get(timeout > 0 ? timeout : 0, TimeUnit.MILLISECONDS);
} catch(final InterruptedException interrupted) {
throw new RequestAbortedException("Request aborted", interrupted);
}
final ConnectionHolder releaseTrigger = new ConnectionHolder(log, connManager, managedConn);
try {
if (execAware != null) {
if (execAware.isAborted()) {
releaseTrigger.abortConnection();
throw new RequestAbortedException("Request aborted");
} else {
execAware.setCancellable(releaseTrigger);
}
}
if (!managedConn.isOpen()) {
final int timeout = config.getConnectTimeout();
this.connManager.connect(
managedConn,
route.getTargetHost(), route.getLocalAddress(),
timeout > 0 ? timeout : 0,
context);
} else {
final int timeout = config.getSocketTimeout();
if (timeout >= 0) {
managedConn.setSocketTimeout(timeout);
}
}
HttpHost target = null;
final HttpRequest original = request.getOriginal();