}
public Client newClient(Connection connection) throws TTransportException, IOException {
String host = connection.getHost();
int port = connection.getPort();
TSocket trans;
Socket socket;
if (connection.isProxy()) {
Proxy proxy = new Proxy(Type.SOCKS, new InetSocketAddress(connection.getProxyHost(), connection.getProxyPort()));
socket = new Socket(proxy);
} else {
socket = new Socket();
}
int timeout = connection.getTimeout();
socket.setTcpNoDelay(true);
socket.setSoTimeout(timeout);
socket.connect(new InetSocketAddress(host, port), timeout);
trans = new TSocket(socket);
TProtocol proto = new TBinaryProtocol(new TFramedTransport(trans, _maxFrameSize));
return new WeightedClient(proto);
}