private Socket SocksProxyConnect(Socket socket, IPEndPoint target)
 {
     try
     {
         var proxyClient = new Socks4aProxyClient(new TcpClient { Client = socket });
         var tcpClient = proxyClient.CreateConnection(target.Address.ToString(), target.Port);
         return tcpClient.Client;
     }
     catch (ProxyException)
     {
         throw new ProxyRouteException(new ProxyServer(ProxyProtocol.HttpConnect, target.Address, target.Port));
     }
 }
        public void TestSocks4aCreateConnection(string proxyHost, int proxyPort, string destHost, int destPort)
        {

            Socks4aProxyClient p = new Socks4aProxyClient();
            p.ProxyHost = proxyHost;
            p.ProxyPort = proxyPort;
            TcpClient c = p.CreateConnection(destHost, destPort);

            byte[] sendBuf = System.Text.ASCIIEncoding.ASCII.GetBytes("GET / HTTP/1.1\n");
            c.GetStream().Write(sendBuf, 0, sendBuf.Length);
            byte[] recvBuf = new byte[1024];
            c.GetStream().Read(recvBuf, 0, recvBuf.Length);
            Console.Out.WriteLine(System.Text.ASCIIEncoding.ASCII.GetString(recvBuf));
            c.Close();
        }