Manual implementation of socks proxy