add unittests and bug fix

This commit is contained in:
hdt3213
2021-05-05 20:51:53 +08:00
parent f1ab47bd83
commit 18d2cbb29b
30 changed files with 704 additions and 446 deletions

View File

@@ -6,6 +6,7 @@ import (
"net"
"strconv"
"testing"
"time"
)
func TestListenAndServe(t *testing.T) {
@@ -42,5 +43,11 @@ func TestListenAndServe(t *testing.T) {
return
}
}
_ = conn.Close()
for i := 0; i < 5; i++ {
// create idle connection
_, _ = net.Dial("tcp", addr)
}
closeChan <- struct{}{}
time.Sleep(time.Second)
}