1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-18 18:36:11 -05:00
v2fly/transport/internet/authenticators/utp/utp_test.go
2016-12-06 11:03:42 +01:00

24 lines
521 B
Go

package utp_test
import (
"testing"
"v2ray.com/core/common/alloc"
"v2ray.com/core/testing/assert"
. "v2ray.com/core/transport/internet/authenticators/utp"
)
func TestUTPOpenSeal(t *testing.T) {
assert := assert.On(t)
content := []byte{'a', 'b', 'c', 'd', 'e', 'f', 'g'}
payload := alloc.NewLocalBuffer(2048)
payload.Append(content)
utp := UTP{}
utp.Seal(payload)
assert.Int(payload.Len()).GreaterThan(len(content))
assert.Bool(utp.Open(payload)).IsTrue()
assert.Bytes(content).Equals(payload.Bytes())
}