if (conn.isOpen()) {
throw new IllegalArgumentException
("Connection must not be open.");
}
final Scheme schm = schemeRegistry.getScheme(target.getSchemeName());
if (schm == null) {
throw new IllegalArgumentException
("Unknown scheme '" + target.getSchemeName() +
"' in target host.");
}
final SocketFactory sf = schm.getSocketFactory();
Socket sock = sf.createSocket();
conn.announce(sock);
try {
sock = sf.connectSocket(sock, target.getHostName(),
schm.resolvePort(target.getPort()),
local, 0, params);
} catch (ConnectException ex) {
throw new HttpHostConnectException(target, ex);
}
prepareSocket(sock, context, params);