Navigation | Overlay |
---|---|
t Navigate files | h Toggle hits |
y Change url to tip of branch | m Toggle misses |
b / v Jump to prev/next hit line | p Toggle partial |
z / x Jump to prev/next missed or partial line | 1..9 Toggle flags |
shift + o Open current page in GitHub | a Toggle all on |
/ or ? Show keyboard shortcuts dialog | c Toggle context lines or commits |
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 ConnectionAttemptTest |
|
9 |
{
|
|
10 |
[Fact]
|
|
11 |
public async Task ParseBytes() |
|
12 | 1 |
{
|
13 | 1 |
var bytes = new byte[] |
14 | 1 |
{
|
15 | 1 |
0x00, 0x1c, 0x00, 0x24, 0x21, 0x12, 0xa4, 0x42, 0x8e, 0x3b, |
16 | 1 |
0x82, 0x73, 0xda, 0x6f, 0xc3, 0xa9, 0x1e, 0x88, 0x8f, 0x0b, |
17 | 1 |
0x00, 0x2a, 0x00, 0x04, 0x21, 0x5a, 0x86, 0x01, 0x00, 0x12, |
18 | 1 |
0x00, 0x08, 0x00, 0x01, 0x60, 0xc6, 0x17, 0x53, 0x9b, 0x96, |
19 | 1 |
0x80, 0x22, 0x00, 0x04, 0x4e, 0x6f, 0x6e, 0x65, 0x80, 0x28, |
20 | 1 |
0x00, 0x04, 0x58, 0x07, 0xfb, 0x8e, |
21 | 1 |
};
|
22 |
|
|
23 | 1 |
using (var stream = new MemoryStream(bytes)) |
24 | 1 |
{
|
25 | 1 |
var response = |
26 | 1 |
(ConnectionAttempt)await StunMessage.Parse(stream); |
27 | 1 |
Assert.Equal( |
28 | 1 |
new byte[] { 0x21, 0x5a, 0x86, 0x01 }, |
29 | 1 |
response.ConnectionId); |
30 | 1 |
}
|
31 | 1 |
}
|
32 |
}
|
|
33 |
}
|
Read our documentation on viewing source code .