public void contactLookupTest()
 {
     ContactLookupMessage x = new ContactLookupMessage();
     ContactLookupMessage y = new ContactLookupMessage(x.getMessageString());
     Assert.AreEqual(x.LookupName, y.LookupName);
     Assert.AreEqual(x.sender, y.sender);
     Assert.AreEqual(x.receiver, y.receiver);
 }
    public string handleContactLookup(string message)
    {
        string returnString = "";
        SqlDataReader dr = null;
        try
        {
            messageSpecs.ContactLookupMessage contactMessage = new messageSpecs.ContactLookupMessage(message);
            dr = mySql.getDataReader(string.Format("EXEC contactLookup '{0}'", contactMessage.LookupName.Trim()));
            while (dr.Read())
            {
                contactMessage.ReturnTable.Rows.Add((long)dr["UserID"], dr["FirstName"], dr["LastName"], dr["UserName"], dr["EmailAddress"]);
            }

            returnString = contactMessage.getMessageString();
        }
        catch
        {

        }
        finally
        {
            if (dr != null)
                dr.Close();
        }

        return returnString;
    }
        public void LookupUser()
        {
            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.ContactLookupMessage x = new messageSpecs.ContactLookupMessage();
            x.LookupName = "coei";
            clientSocket.Send(x.getMessageString());

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