1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-04 19:14:33 -04:00
v2fly/transport/internet/headers/utp/utp_test.go
2019-02-02 22:19:30 +01:00

27 lines
546 B
Go

package utp_test
import (
"context"
"testing"
"v2ray.com/core/common"
"v2ray.com/core/common/buf"
. "v2ray.com/core/transport/internet/headers/utp"
)
func TestUTPWrite(t *testing.T) {
content := []byte{'a', 'b', 'c', 'd', 'e', 'f', 'g'}
utpRaw, err := New(context.Background(), &Config{})
common.Must(err)
utp := utpRaw.(*UTP)
payload := buf.New()
utp.Serialize(payload.Extend(utp.Size()))
payload.Write(content)
if payload.Len() != int32(len(content))+utp.Size() {
t.Error("unexpected payload length: ", payload.Len())
}
}