public void ClientToServer()
        {
            EasyNetwork.Server server = new EasyNetwork.Server("tcp://*:1982");
            EasyNetwork.Client clientOne = new EasyNetwork.Client("tcp://localhost:1982");
            EasyNetwork.Client clientTwo = new EasyNetwork.Client("tcp://localhost:1982");
            MyTestObject obj = new MyTestObject();
            obj.Value = 3.14159f;
            obj.Text = "Hello World!";

            OtherTestObject obj2 = new OtherTestObject();
            obj2.Value = 1234;
            obj2.Text = "Hello World Again!";

            server.Start();
            clientOne.Start();
            clientTwo.Start();

            clientOne.Send<MyTestObject>(obj);
            clientTwo.Send<OtherTestObject>(obj2);

            // Generically receive object at server from first client
            Object receivedObject = null;
            while (receivedObject == null)
            {
                Guid firstId;
                receivedObject = server.Receive(out firstId);

                if (receivedObject is MyTestObject)
                {
                    MyTestObject actualObjectOne = receivedObject as MyTestObject;
                    Assert.AreEqual(clientOne.Id, firstId);
                    Assert.AreEqual(obj.Value, actualObjectOne.Value);
                    Assert.AreEqual(obj.Text, actualObjectOne.Text);
                }

                Thread.Sleep(100);
            }

            // Generically receive object at server from second client
            receivedObject = null;
            while (receivedObject == null)
            {
                Guid secondId;
                receivedObject = server.Receive(out secondId);

                if (receivedObject is OtherTestObject)
                {
                    OtherTestObject actualObjectTwo = receivedObject as OtherTestObject;
                    Assert.AreEqual(clientTwo.Id, secondId);
                    Assert.AreEqual(obj2.Value, actualObjectTwo.Value);
                    Assert.AreEqual(obj2.Text, actualObjectTwo.Text);
                }

                Thread.Sleep(100);
            }

            server.Stop();
            clientOne.Stop();
            clientTwo.Stop();
        }
        public void ClientToServer()
        {
            EasyNetwork.Server server = new EasyNetwork.Server("tcp://*:1982");
            EasyNetwork.Client clientOne = new EasyNetwork.Client("tcp://localhost:1982");
            EasyNetwork.Client clientTwo = new EasyNetwork.Client("tcp://localhost:1982");

            // Set up event handler on server
            serverObjectsReceived.Clear();
            server.DataReceived += Server_DataReceived;

            // Build up some objects to send
            MyTestObject obj = new MyTestObject();
            obj.Value = 3.14159f;
            obj.Text = "Hello World!";

            OtherTestObject obj2 = new OtherTestObject();
            obj2.Value = 1234;
            obj2.Text = "Hello World Again!";

            server.Start();
            clientOne.Start();
            clientTwo.Start();

            clientOne.Send<MyTestObject>(obj);
            clientTwo.Send<OtherTestObject>(obj2);

            // Wait for both objects to arrive at server
            while (serverObjectsReceived.Count < 2)
            {
                Thread.Sleep(100);
            }

            Assert.AreEqual(2, serverObjectsReceived.Count);

            Assert.IsTrue(serverObjectsReceived[0].Item1 is MyTestObject);
            MyTestObject actualObjectOne = serverObjectsReceived[0].Item1 as MyTestObject;
            Assert.AreEqual(clientOne.Id, serverObjectsReceived[0].Item2);
            Assert.AreEqual(obj.Value, actualObjectOne.Value);
            Assert.AreEqual(obj.Text, actualObjectOne.Text);

            Assert.IsTrue(serverObjectsReceived[1].Item1 is OtherTestObject);
            OtherTestObject actualObjectTwo = serverObjectsReceived[1].Item1 as OtherTestObject;
            Assert.AreEqual(clientTwo.Id, serverObjectsReceived[1].Item2);
            Assert.AreEqual(obj2.Value, actualObjectTwo.Value);
            Assert.AreEqual(obj2.Text, actualObjectTwo.Text);

            server.Stop();
            clientOne.Stop();
            clientTwo.Stop();
        }