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