public synchronized void open(
final HttpRoute route,
final HttpContext context,
final HttpParams params) throws IOException {
HttpPoolEntry entry = ensurePoolEntry();
RouteTracker tracker = entry.getTracker();
if (tracker.isConnected()) {
throw new IllegalStateException("Connection already open");
}
HttpHost target = route.getTargetHost();
HttpHost proxy = route.getProxyHost();
IOSession iosession = entry.getConnection();
if (proxy == null) {
AsyncScheme scheme = this.manager.getSchemeRegistry().getScheme(target);
LayeringStrategy layeringStrategy = scheme.getLayeringStrategy();
if (layeringStrategy != null) {
iosession = layeringStrategy.layer(iosession);
}
}
ClientAsyncConnection conn = this.connFactory.create(
"http-outgoing-" + entry.getId(),
iosession,
params);
iosession.setAttribute(IOEventDispatch.CONNECTION_KEY, conn);
if (proxy == null) {
tracker.connectTarget(conn.getIOSession() instanceof SSLIOSession);
} else {
tracker.connectProxy(proxy, false);
}
}