public void CreateSocket()
        {
             SocketHandler.SocketServer mySockets = new SocketHandler.SocketServer(0, 1000);
             SocketHandler.SocketClient clientSocket = null;
             mySockets.Init();
             mySockets.Start(new System.Net.IPEndPoint(System.Net.IPAddress.Parse("127.0.0.1"), 20000));
             clientSocket = new SocketHandler.SocketClient("127.0.0.1", 20000, false, ((char)2).ToString(), ((char)3).ToString());

             System.Threading.Thread.Sleep(1000);
             Assert.AreEqual(true, clientSocket.Connected);
        }
        public void CreateUser()
        {
            SocketHandler.SocketServer mySockets = new SocketHandler.SocketServer(0, 1000);
            SocketHandler.SocketClient clientSocket = null;
            mySockets.Init();
            mySockets.Start(new System.Net.IPEndPoint(System.Net.IPAddress.Parse("127.0.0.1"), 20000));
            clientSocket = new SocketHandler.SocketClient("127.0.0.1", 20000, false, ((char)2).ToString(), ((char)3).ToString());

            messageSpecs.UserCreationMessage myCreationMessage = new messageSpecs.UserCreationMessage();
            myCreationMessage.EmailAddress = "*****@*****.**";
            myCreationMessage.UserName = "******";
            myCreationMessage.FirstName = "Cody";
            myCreationMessage.LastName = "Eidsness";
            clientSocket.Send(myCreationMessage.getMessageString());

            for(int i = 1;i<=5;i++)
            {
                System.Threading.Thread.Sleep(1000);
                while (clientSocket.messageQueue.Count > 0)
                {
                    if (clientSocket.messageQueue.Dequeue().Substring(0, 5) == UserCreationMessage.CreateUserMessageType)
                    {
                        return;
                    }
                }
            }
            Assert.Fail("Never got login message back");
        }
        public void AddContact()
        {
            SocketHandler.SocketServer mySockets = new SocketHandler.SocketServer(0, 1000);
            SocketHandler.SocketClient clientSocket = null;
            mySockets.Init();
            mySockets.Start(new System.Net.IPEndPoint(System.Net.IPAddress.Parse("127.0.0.1"), 20000));
            clientSocket = new SocketHandler.SocketClient("127.0.0.1", 20000, false, ((char)2).ToString(), ((char)3).ToString());

            messageSpecs.AddContactMessage x = new messageSpecs.AddContactMessage();
            x.sender = "10006";
            x.receiver = "2";
            clientSocket.Send(x.getMessageString());

            for (int i = 1; i <= 5; i++)
            {
                System.Threading.Thread.Sleep(1000);
                while (clientSocket.messageQueue.Count > 0)
                {
                    if (clientSocket.messageQueue.Dequeue().Substring(0, 5) == AddContactMessage.AddContactMessageType)
                        return;
                }
            }
            Assert.Fail("Never got login message back");
        }