private void ConnectSocket()
        {
            if (this._proxySocket == null)
            {
                var socket = new Socket(_remoteEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
                socket.Connect(_remoteEndPoint);

                if (this._isSecure)
                    Socket = new SocketWrapper(socket, this._certificate, this._uri);
                else
                    Socket = new SocketWrapper(socket);

            }
            else
            {
                var socket = this._proxySocket;

                var ca = new SocketAsyncEventArgs();
                ca.RemoteEndPoint = _remoteEndPoint;
                ca.Completed += (sender, args) => { Socket = new SocketWrapper((Socket)sender); };

                socket.ConnectAsync(ca);
                Thread.Sleep(2000);
            }
        }
        private void ConnectSocket()
        {
            var socket = new Socket(_remoteEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
            socket.Connect(_remoteEndPoint);

            if (this._isSecure)
                Socket = new SocketWrapper(socket, this._certificate);
            else
                Socket = new SocketWrapper(socket);
        }