File: channel_open_test.go

package info (click to toggle)
golang-github-microsoft-dev-tunnels 0.0.25-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,988 kB
  • sloc: cs: 9,969; java: 2,767; javascript: 328; xml: 186; makefile: 5
file content (35 lines) | stat: -rw-r--r-- 810 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

package messages

import (
	"bytes"
	"testing"
)

func TestUnmarshalChannelOpen(t *testing.T) {
	co := newChannelOpen(11, 0, 0)
	b, err := co.marshal()
	if err != nil {
		t.Error(err)
	}

	buf := bytes.NewReader(b)
	co2 := new(channelOpen)
	if err := co2.unmarshal(buf); err != nil {
		t.Error(err)
	}

	if co.senderChannel != co2.senderChannel {
		t.Errorf("senderChannel: want %d, got %d", co.senderChannel, co2.senderChannel)
	}

	if co.initialWindowSize != co2.initialWindowSize {
		t.Errorf("initialWindowSize: want %d, got %d", co.initialWindowSize, co2.initialWindowSize)
	}

	if co.maximumPacketSize != co2.maximumPacketSize {
		t.Errorf("maximumPacketSize: want %d, got %d", co.maximumPacketSize, co2.maximumPacketSize)
	}
}