I have a piece of code to connect to a Socket server, and it works fine.
Socket socket = new Socket(); socket.connect(new InetSocketAddress(address, port));
You could try JHttpTunnel, though you need software running on both sides of the tunnel for this to work.