1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-18 10:26:01 -05:00
v2fly/transport/internet/header_test.go
2016-12-15 11:51:09 +01:00

29 lines
801 B
Go

package internet_test
import (
"testing"
"v2ray.com/core/common/serial"
"v2ray.com/core/testing/assert"
. "v2ray.com/core/transport/internet"
"v2ray.com/core/transport/internet/headers/noop"
"v2ray.com/core/transport/internet/headers/srtp"
"v2ray.com/core/transport/internet/headers/utp"
)
func TestAllHeadersLoadable(t *testing.T) {
assert := assert.On(t)
noopAuth, err := CreatePacketHeader(serial.GetMessageType(new(noop.Config)), nil)
assert.Error(err).IsNil()
assert.Int(noopAuth.Size()).Equals(0)
srtp, err := CreatePacketHeader(serial.GetMessageType(new(srtp.Config)), nil)
assert.Error(err).IsNil()
assert.Int(srtp.Size()).Equals(4)
utp, err := CreatePacketHeader(serial.GetMessageType(new(utp.Config)), nil)
assert.Error(err).IsNil()
assert.Int(utp.Size()).Equals(4)
}