public void TPKT_ReadStreamTooShort() { var fullMessage = ProtocolUnitTest.StringToByteArray("0300002902f0803203000000010002001400"); var m = new TestStream1BytePerRead(fullMessage); Assert.ThrowsException <TPKTInvalidException>(() => TPKT.Read(m)); }
public async Task TPKT_Read() { var m = new MemoryStream(StringToByteArray("0300002902f0803203000000010002001400000401ff0400807710000100000103000000033f8ccccd")); var t = await TPKT.ReadAsync(m, TestContext.CancellationTokenSource.Token); Assert.AreEqual(0x03, t.Version); Assert.AreEqual(0x29, t.Length); }
public void TPKT_ReadRestrictedStream() { var fullMessage = ProtocolUnitTest.StringToByteArray("0300002902f0803203000000010002001400000401ff0400807710000100000103000000033f8ccccd"); var m = new TestStream1BytePerRead(fullMessage); var t = TPKT.Read(m); Assert.AreEqual(fullMessage.Length, t.Length); Assert.AreEqual(fullMessage.Last(), t.Data.Last()); }
public async Task TPKT_ReadRestrictedStreamAsync() { var fullMessage = ProtocolUnitTest.StringToByteArray("0300002902f0803203000000010002001400000401ff0400807710000100000103000000033f8ccccd"); var m = new TestStream1BytePerRead(fullMessage); var t = await TPKT.ReadAsync(m, TestContext.CancellationTokenSource.Token); Assert.AreEqual(fullMessage.Length, t.Length); Assert.AreEqual(fullMessage.Last(), t.Data.Last()); }
public void TPKT_Read() { var m = new MemoryStream(StringToByteArray("0300002902f0803203000000010002001400000401ff0400807710000100000103000000033f8ccccd")); var t = TPKT.Read(m); Assert.AreEqual(0x03, t.Version); Assert.AreEqual(0x29, t.Length); m.Position = 0; t = TPKT.ReadAsync(m).Result; Assert.AreEqual(0x03, t.Version); Assert.AreEqual(0x29, t.Length); }
public async Task TPKT_ReadShortAsync() { var m = new MemoryStream(StringToByteArray("0300002902f0803203000000010002001400000401ff040080")); var t = await TPKT.ReadAsync(m, TestContext.CancellationTokenSource.Token); }
public void TPKT_ReadShort() { var m = new MemoryStream(StringToByteArray("0300002902f0803203000000010002001400000401ff040080")); var t = TPKT.Read(m); }
public async Task TPKT_ReadShortAsync() { var m = new MemoryStream(StringToByteArray("0300002902f0803203000000010002001400000401ff040080")); var t = await TPKT.ReadAsync(m); }
public async Task TPKT_ReadShort() { var m = new MemoryStream(StringToByteArray("0300002902f0803203000000010002001400000401ff040080")); var t = await TPKT.ReadAsync(m, CancellationToken.None); }