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); }
public void ThrowsExceptionTryingToReadByteOnClosed() { Session session = new Session("localhost", DefaultPort); server.AcceptTcpClient().Close(); Assert.Throws<SocketException>(() => session.ReadByte()); }