Close() public method

public Close ( ) : void
return void
Esempio n. 1
0
        public void CanReceiveByte()
        {
            byte expected = 0x03;

            Session session = new Session("localhost", DefaultPort);
            AcceptAndSendBytes(new byte[] { expected });

            byte actual = session.ReadByte();
            session.Close();

            Assert.AreEqual(expected, actual);
        }
Esempio n. 2
0
        public void CanSendByte()
        {
            byte expected = 0xCA;
            Session session = new Session("localhost", DefaultPort);
            session.Write(expected);

            TcpClient client = server.AcceptTcpClient();
            int actual = client.GetStream().ReadByte();

            Assert.AreEqual(expected, actual);

            client.Close();
            session.Close();
        }
Esempio n. 3
0
        public void CanSendBytes()
        {
            byte[] expected = new byte[] { 0xCA, 0xFE };
            Session session = new Session("localhost", DefaultPort);
            session.Write(expected);

            TcpClient client = server.AcceptTcpClient();
            byte[] actual = new byte[2];
            client.GetStream().Read(actual, 0, 2);

            Assert.AreEqual(expected, actual);

            client.Close();
            session.Close();
        }
Esempio n. 4
0
        public void ReceiveUntilByteNoRepeated()
        {
            Session session = new Session("localhost", DefaultPort);
            TcpClient client = server.AcceptTcpClient();

            byte sepByte = 0xCA;
            byte[] expected = new byte[] { 0xCA, 0xFE, 0xBE };
            client.GetStream().Write(expected, 0, expected.Length);

            byte[] actual = session.ReadPacket(sepByte);
            Assert.AreEqual(expected, actual);

            client.Close();
            session.Close();
        }