Here you can find the source of getSocketToProxyServer(String host, int port)
public static Socket getSocketToProxyServer(String host, int port) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.net.InetSocketAddress; import java.net.Socket; public class Main { public static Socket getSocketToProxyServer(String host, int port) throws IOException { Socket socket = new Socket(); socket.connect(new InetSocketAddress(host, port), 1000); socket.setSoTimeout(300000);/*from w w w. j av a2 s . c om*/ return socket; } }