1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-16 09:26:21 -05:00
v2fly/transport/internet/header_test.go

29 lines
801 B
Go
Raw Normal View History

2016-12-08 10:27:41 -05:00
package internet_test
import (
"testing"
2016-12-15 05:51:09 -05:00
"v2ray.com/core/common/serial"
2016-12-08 10:27:41 -05:00
"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)
2016-12-15 05:51:09 -05:00
noopAuth, err := CreatePacketHeader(serial.GetMessageType(new(noop.Config)), nil)
2016-12-08 10:27:41 -05:00
assert.Error(err).IsNil()
assert.Int(noopAuth.Size()).Equals(0)
2016-12-15 05:51:09 -05:00
srtp, err := CreatePacketHeader(serial.GetMessageType(new(srtp.Config)), nil)
2016-12-08 10:27:41 -05:00
assert.Error(err).IsNil()
assert.Int(srtp.Size()).Equals(4)
2016-12-15 05:51:09 -05:00
utp, err := CreatePacketHeader(serial.GetMessageType(new(utp.Config)), nil)
2016-12-08 10:27:41 -05:00
assert.Error(err).IsNil()
assert.Int(utp.Size()).Equals(4)
}