public void StreamSerializeCableCloudMessageTest()
        {
            var tcpListener = new TcpListener(IPAddress.Loopback, 10000);

            tcpListener.Start();
            var acceptTask = AcceptTask(tcpListener);

            var client1 = new TcpClient();

            client1.Connect(IPAddress.Loopback, 10000);
            var client2 = acceptTask.Result;


            var expected = new CableCloudMessage(1, AtmCell.Generate(1, 1, "TEST"));

            BinarySerializer.SerializeToStream(expected, client1.GetStream());
            var actual = (CableCloudMessage)BinarySerializer.DeserializeFromStream(client2.GetStream());

            Assert.AreEqual(expected.PortNumber, actual.PortNumber);
        }
        public void StreamSerializeSignallingMessageTest()
        {
            var tcpListener = new TcpListener(IPAddress.Loopback, 10000);

            tcpListener.Start();
            var acceptTask = AcceptTask(tcpListener);

            var client1 = new TcpClient();

            client1.Connect(IPAddress.Loopback, 10000);
            var client2 = acceptTask.Result;


            var expected = new SignallingMessage();


            BinarySerializer.SerializeToStream(expected, client1.GetStream());
            var actual = (SignallingMessage)BinarySerializer.DeserializeFromStream(client2.GetStream());

            ;

            Assert.AreEqual(expected.SessionId, actual.SessionId);
        }
 private object Receive(Stream networkStream)
 {
     return(BinarySerializer.DeserializeFromStream(networkStream));
 }
Ejemplo n.º 4
0
        private object Receive()
        {
            var networkStream = _tcpClient.GetStream();

            return(BinarySerializer.DeserializeFromStream(networkStream));
        }