diff --git a/common/turbotunnel/queuepacketconn_test.go b/common/turbotunnel/queuepacketconn_test.go index 3b4c848..0ff19b2 100644 --- a/common/turbotunnel/queuepacketconn_test.go +++ b/common/turbotunnel/queuepacketconn_test.go @@ -215,14 +215,15 @@ func TestQueuePacketConnWriteToKCP(t *testing.T) { panic(err) } + // A sleep after the Write makes buffer reuse more likely, + // and to allow the connection to flush before close + time.Sleep(500 * time.Millisecond) + err = conn.Close() if err != nil { panic(err) } - // A sleep after the Write makes buffer reuse more likely. - time.Sleep(100 * time.Millisecond) - if transcript.Length() == 0 { panic("empty transcript") }