final HttpRoute route,
final HttpContext context) throws IOException {
Args.notNull(managedConn, "Managed connection");
Args.notNull(route, "HTTP route");
final HttpHost host = route.getTargetHost();
final SchemeIOSessionFactory sf = this.iosessionFactoryRegistry.lookup(
host.getSchemeName());
if (sf == null) {
throw new IOException("Unsupported scheme: " + host.getSchemeName());
}
synchronized (managedConn) {
final CPoolEntry entry = CPoolProxy.getPoolEntry(managedConn);
final ManagedNHttpClientConnection conn = entry.getConnection();
Asserts.check(sf.isLayering(), "Layering is not supported for this scheme");
final IOSession currentSession = sf.create(host, conn.getIOSession());
conn.bind(currentSession);
}
}