ReadPacket() public method

public ReadPacket ( byte separator ) : byte[]
separator byte
return byte[]
Exemplo n.º 1
0
 public void ThrowsExceptionTryingToReadPacketOnClosed()
 {
     Session session = new Session("localhost", DefaultPort);
     server.AcceptTcpClient().Close();
     Assert.Throws<SocketException>(() => session.ReadPacket(0xCA));
 }
Exemplo n.º 2
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();
        }