public void HandshakeDecoding() { byte[] infohash = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 12, 15, 12, 52 }; HandshakeMessage orig = new HandshakeMessage(new InfoHash(infohash), "12312312345645645678", VersionInfo.ProtocolStringV100); orig.Encode(buffer, offset); HandshakeMessage dec = new HandshakeMessage(); dec.Decode(buffer, offset, HandshakeMessage.HandshakeLength); Assert.IsTrue(orig.Equals(dec)); Assert.AreEqual(orig.Encode(), dec.Encode()); }
public void HandshakeDecoding() { var infohash = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 12, 15, 12, 52 }; var orig = new HandshakeMessage(new InfoHash(infohash), "12312312345645645678", VersionInfo.ProtocolStringV100); orig.Encode(_buffer, Offset); var dec = new HandshakeMessage(); dec.Decode(_buffer, Offset, 68); Assert.IsTrue(orig.Equals(dec)); Assert.AreEqual(orig.Encode(), dec.Encode()); }