package netforward import ( "fmt" "testing" "time" ) func TestForward(t *testing.T) { var f = NetForward{ LocalAddr: "127.0.0.1", LocalPort: 22232, RemoteURI: "192.168.2.1:80", EnableTCP: true, EnableUDP: true, DialTimeout: 6 * time.Second, UDPTimeout: 7 * time.Second, } f.Run() go func() { time.Sleep(time.Second * 10) fmt.Println("closing") f.Close() }() for { time.Sleep(time.Second * 2) if f.Status() > 0 { fmt.Println(f.Status()) continue } return } }