utp_test.go 421 B

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