public void GetIpV4BytesTest()
        {
            AddressAttribute target = new MappedAddress()
            {
                IpAddress = IPAddress.Loopback,
                Port = 0x1234,
            };

            byte[] expected = new byte[]
            {
                0xee, 0xee, 0xee, 0xee,
                0x00, 0x01, 0x00, 0x08,
                0x00, 0x01, 0x12, 0x34,
                0x7f, 0x00, 0x00, 0x01,
            };

            byte[] actual = new byte[]
            {
                0xee, 0xee, 0xee, 0xee,
                0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00,
            };

            int startIndex = 4;
            target.GetBytes(actual, ref startIndex);

            Assert.AreEqual(16, startIndex);
            Helpers.AreArrayEqual(expected, actual);
            Assert.AreEqual(AddressFamily.InterNetwork, target.IpEndPoint.AddressFamily);
        }
        public void GetIpV6BytesTest()
        {
            AddressAttribute target = new MappedAddress()
            {
                IpAddress = IPAddress.Parse("0102:0304:0506:0708:090a:0b0c:0d0e:0f10"),
                Port = 0x1234,
            };

            byte[] expected = new byte[]
            {
                0xee, 0xee, 0xee, 0xee,
                0x00, 0x01, 0x00, 20,
                0x00, 0x02, 0x12, 0x34,
                0x01, 0x02, 0x03, 0x04,
                0x05, 0x06, 0x07, 0x08,
                0x09, 0x0a, 0x0b, 0x0c,
                0x0d, 0x0e, 0x0f, 0x10,
            };

            byte[] actual = new byte[]
            {
                0xee, 0xee, 0xee, 0xee,
                0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00,
            };

            int startIndex = 4;
            target.GetBytes(actual, ref startIndex);

            Assert.AreEqual(28, startIndex);
            Helpers.AreArrayEqual(expected, actual);

            Assert.AreEqual(AddressFamily.InterNetworkV6, target.IpEndPoint.AddressFamily);
        }