Esempio n. 1
0
        public void Multiple_Login_Attempts()
        {
            Server s = new Server();

            ThreadPool.QueueUserWorkItem(s.ImServer.StartServer, null);
            Thread.Sleep(20);

            int reg = 0;

            while (s.ImServer.ServerActive && reg != 6)
            {
                var clientAuth1 = new ImClientHandler(
                    s.ImServer.IpAddress.ToString(),
                    s.ImServer.PortAddress);
                clientAuth1.Login(_clients[reg]);
                Thread.Sleep(200);
                reg++;
            }
            Assert.IsTrue(
                s.ImServer.CurrentClients._imUsers.ToList()
                .Select(cli => cli.Value.LoggedIn).Count() == 6);
            s.ImServer.StopServer();
        }
Esempio n. 2
0
        public void Asymmetrical_Key_Regeneration_Attempt()
        {
            Server s = new Server();

            ThreadPool.QueueUserWorkItem(s.ImServer.StartServer, null);
            Thread.Sleep(20);

            ImClientHandler client =
                new ImClientHandler(s.ImServer.IpAddress.ToString(), s.ImServer.PortAddress);

            client.Login(_clients[0]);
            Thread.Sleep(200);

            RSAParameters oldKey = client.PublicKey;

            IMClient.utils.Cryptography.DeleteKeyFromContainer();
            IMClient.utils.Cryptography.GenerateKeys(out client.PublicKey);

            Thread.Sleep(1000);

            Assert.IsFalse(oldKey.Equals(client.PublicKey));
            s.ImServer.StopServer();
        }
Esempio n. 3
0
 private void Login(object sender, RoutedEventArgs e)
 {
     _clientModel.UserPassword = txtPassword.Password;
     _clientHandler.Login(_clientModel);
 }