github.com/Asutorufa/yuhaiin@v0.3.6-0.20240502055049-7984da7023a0/pkg/net/proxy/reject/reject_test.go (about)

     1  package reject
     2  
     3  import (
     4  	"testing"
     5  	"time"
     6  
     7  	"github.com/Asutorufa/yuhaiin/pkg/net/netapi"
     8  )
     9  
    10  func TestReject(t *testing.T) {
    11  	r := NewReject(5, 15)
    12  
    13  	addr := netapi.ParseAddressPort(0, "www.baidu.com", netapi.ParsePort(0))
    14  	z := time.Millisecond * 300
    15  	for {
    16  		if z >= time.Second*10 {
    17  			break
    18  		}
    19  
    20  		t.Log(r.(*reject).delay(addr))
    21  
    22  		// time.Sleep(time.Second)
    23  		// z += time.Microsecond * 500
    24  	}
    25  }