github.com/pion/dtls/v2@v2.2.12/nettest_test.go (about)

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