1
using System.IO;
2
using System.Threading.Tasks;
3
using Libplanet.Stun.Messages;
4
using Xunit;
5

6
namespace Libplanet.Stun.Tests.Messages
7
{
8
    public class CreatePermissionSuccessResponseTest
9
    {
10
        [Fact]
11
        public async Task ParseBytes()
12 1
        {
13 1
            var bytes = new byte[]
14 1
            {
15 1
                0x01, 0x08, 0x00, 0x28, 0x21, 0x12, 0xa4, 0x42, 0xf8, 0x57,
16 1
                0xe3, 0x50, 0x4c, 0x8f, 0xd3, 0x9d, 0xb8, 0xca, 0x69, 0x83,
17 1
                0x80, 0x22, 0x00, 0x04, 0x4e, 0x6f, 0x6e, 0x65, 0x00, 0x08,
18 1
                0x00, 0x14, 0xee, 0x56, 0x3a, 0x74, 0x03, 0x16, 0x80, 0xc4,
19 1
                0xe5, 0x2f, 0xfa, 0x37, 0x1e, 0x30, 0x42, 0xa6, 0x45, 0x15,
20 1
                0x8e, 0x84, 0x80, 0x28, 0x00, 0x04, 0xa0, 0x39, 0xc6, 0x25,
21 1
            };
22

23 1
            using (var stream = new MemoryStream(bytes))
24 1
            {
25 1
                var response = await StunMessage.Parse(stream);
26 1
                Assert.Equal(
27 1
                    new byte[]
28 1
                    {
29 1
                        0xf8, 0x57, 0xe3, 0x50, 0x4c, 0x8f, 0xd3, 0x9d, 0xb8, 0xca,
30 1
                        0x69, 0x83,
31 1
                    },
32 1
                    response.TransactionId);
33 1
                Assert.IsType<CreatePermissionSuccessResponse>(response);
34 1
            }
35 1
        }
36
    }
37
}

Read our documentation on viewing source code .

Loading