private bool ConnectToJSSH()
        {
            connection = new JSSHConnection();
            
            DateTime timeout = DateTime.Now.AddSeconds(10);
            do
            {
                if (connection.ConnectToJSSH())
                {
                    return true;
                }
                Thread.Sleep(0);
            } while (DateTime.Now < timeout);

            return false;
        }
 public void TestJSSHConnectionConstructorCorrectlyCopiesSessionVariablesWhenPassedValidGuid()
 {
     string guid = Guid.NewGuid().ToString();
     Assert.IsTrue(SetUpJSSHVariables());
     Assert.AreEqual(guid, AddGuidToWindow(guid));
     using (JSSHConnection jssh = new JSSHConnection(guid))
     {
         Assert.IsTrue(AreSessionVariablesDefined());
     }
 }
 public void TestConnectedPropertyReturnsFalseWhenSocketIsNull()
 {
     JSSHConnection nullConnection = new JSSHConnection();
     nullConnection.Dispose();
     Assert.IsFalse(nullConnection.Connected);
 }