mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-09-05 19:44:32 -04:00
27 lines
511 B
Go
27 lines
511 B
Go
package utp_test
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"v2ray.com/core/common/buf"
|
|
. "v2ray.com/core/transport/internet/headers/utp"
|
|
. "v2ray.com/ext/assert"
|
|
)
|
|
|
|
func TestUTPWrite(t *testing.T) {
|
|
assert := With(t)
|
|
|
|
content := []byte{'a', 'b', 'c', 'd', 'e', 'f', 'g'}
|
|
utpRaw, err := New(context.Background(), &Config{})
|
|
assert(err, IsNil)
|
|
|
|
utp := utpRaw.(*UTP)
|
|
|
|
payload := buf.New()
|
|
payload.AppendSupplier(utp.Write)
|
|
payload.Write(content)
|
|
|
|
assert(payload.Len(), Equals, int32(len(content))+utp.Size())
|
|
}
|