public static TcpClient Connect(string host, int controlPort, string controlPassword)
        {
            bool controlAuthenticate = Engine.Instance.Storage.GetBool("proxy.tor.control.auth");

            byte[] password = System.Text.Encoding.ASCII.GetBytes(controlPassword);

            if (controlAuthenticate)
            {
                if (controlPassword == "")
                {
                    string path = GetControlAuthCookiePath();

                    if (path == "")
                    {
                        throw new Exception(Messages.TorControlNoPath);
                    }

                    Engine.Instance.Logs.Log(LogType.Verbose, MessagesFormatter.Format(Messages.TorControlAuth, "Cookie, from " + path));

                    password = Platform.Instance.FileContentsReadBytes(path);
                }
                else
                {
                    Engine.Instance.Logs.Log(LogType.Verbose, MessagesFormatter.Format(Messages.TorControlAuth, "Password"));
                }
            }

            TcpClient s = new TcpClient();

            s.Connect(host, controlPort);

            if (controlAuthenticate)
            {
                Write(s, "AUTHENTICATE ");
                Write(s, Utils.BytesToHex(password));
                Write(s, "\n");

                string result = Read(s);

                if (result != "250 OK")
                {
                    throw new Exception(result);
                }
            }

            Flush(s);

            return(s);
        }