utp_test.go 440 B

12345678910111213141516171819202122
  1. package utp_test
  2. import (
  3. "testing"
  4. "v2ray.com/core/common/buf"
  5. "v2ray.com/core/testing/assert"
  6. . "v2ray.com/core/transport/internet/headers/utp"
  7. )
  8. func TestUTPWrite(t *testing.T) {
  9. assert := assert.On(t)
  10. content := []byte{'a', 'b', 'c', 'd', 'e', 'f', 'g'}
  11. utp := UTP{}
  12. payload := buf.NewLocalBuffer(2048)
  13. payload.AppendFunc(utp.Write)
  14. payload.Append(content)
  15. assert.Int(payload.Len()).Equals(len(content) + utp.Size())
  16. }