nettest_test.go 580 B

123456789101112131415161718192021222324252627282930313233
  1. // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
  2. // SPDX-License-Identifier: MIT
  3. //go:build !js
  4. // +build !js
  5. package dtls
  6. import (
  7. "net"
  8. "testing"
  9. "time"
  10. "github.com/pion/transport/v2/test"
  11. "golang.org/x/net/nettest"
  12. )
  13. func TestNetTest(t *testing.T) {
  14. lim := test.TimeOut(time.Minute*1 + time.Second*10)
  15. defer lim.Stop()
  16. nettest.TestConn(t, func() (c1, c2 net.Conn, stop func(), err error) {
  17. c1, c2, err = pipeMemory()
  18. if err != nil {
  19. return nil, nil, nil, err
  20. }
  21. stop = func() {
  22. _ = c1.Close()
  23. _ = c2.Close()
  24. }
  25. return
  26. })
  27. }