mirror of
				https://github.com/ehang-io/nps
				synced 2025-10-30 15:26:58 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			41 lines
		
	
	
		
			694 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			694 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package mux
 | |
| 
 | |
| import (
 | |
| 	"testing"
 | |
| 	"time"
 | |
| 
 | |
| 	"github.com/astaxie/beego/logs"
 | |
| )
 | |
| 
 | |
| func TestPortMux_Close(t *testing.T) {
 | |
| 	logs.Reset()
 | |
| 	logs.EnableFuncCallDepth(true)
 | |
| 	logs.SetLogFuncCallDepth(3)
 | |
| 
 | |
| 	pMux := NewPortMux(8888, "Ds")
 | |
| 	go func() {
 | |
| 		if pMux.Start() != nil {
 | |
| 			logs.Warn("Error")
 | |
| 		}
 | |
| 	}()
 | |
| 	time.Sleep(time.Second * 3)
 | |
| 	go func() {
 | |
| 		l := pMux.GetHttpListener()
 | |
| 		conn, err := l.Accept()
 | |
| 		logs.Warn(conn, err)
 | |
| 	}()
 | |
| 	go func() {
 | |
| 		l := pMux.GetHttpListener()
 | |
| 		conn, err := l.Accept()
 | |
| 		logs.Warn(conn, err)
 | |
| 	}()
 | |
| 	go func() {
 | |
| 		l := pMux.GetHttpListener()
 | |
| 		conn, err := l.Accept()
 | |
| 		logs.Warn(conn, err)
 | |
| 	}()
 | |
| 	l := pMux.GetHttpListener()
 | |
| 	conn, err := l.Accept()
 | |
| 	logs.Warn(conn, err)
 | |
| }
 | 
