srtp_test.go 521 B

1234567891011121314151617181920212223242526
  1. package srtp_test
  2. import (
  3. "context"
  4. "testing"
  5. "v2ray.com/core/common/buf"
  6. . "v2ray.com/core/transport/internet/headers/srtp"
  7. . "v2ray.com/ext/assert"
  8. )
  9. func TestSRTPWrite(t *testing.T) {
  10. assert := With(t)
  11. content := []byte{'a', 'b', 'c', 'd', 'e', 'f', 'g'}
  12. srtpRaw, err := New(context.Background(), &Config{})
  13. assert(err, IsNil)
  14. srtp := srtpRaw.(*SRTP)
  15. payload := buf.New()
  16. payload.AppendSupplier(srtp.Write)
  17. payload.Append(content)
  18. assert(payload.Len(), Equals, int32(len(content))+srtp.Size())
  19. }