public void Connect(int sendTimeout = -1, int receiveTimeout = -1) { SSLSocket sslSocket = null; var f = SSLSocketFactory.Default as SSLSocketFactory; sslSocket = f.CreateSocket() as SSLSocket; _socket = sslSocket; _socket.SoTimeout = receiveTimeout == -1 ? 0 : receiveTimeout; sslSocket.Connect(new InetSocketAddress(_remoteHostName, _remotePort), 15000); sslSocket.StartHandshake(); _socket.SoTimeout = 0; }