@@ -39,7 +39,7 @@ func TestConn(t *testing.T) {
39
39
40
40
for i := 0 ; i < 1 ; i ++ {
41
41
t .Run ("" , func (t * testing.T ) {
42
- ctx , cancel := context .WithTimeout (context .Background (), time .Second )
42
+ ctx , cancel := context .WithTimeout (context .Background (), time .Second * 5 )
43
43
defer cancel ()
44
44
45
45
c1 , c2 := websocketPipe (t )
@@ -49,6 +49,7 @@ func TestConn(t *testing.T) {
49
49
assertCloseStatus (t , websocket .StatusNormalClosure , err )
50
50
})
51
51
defer wait ()
52
+ defer cancel ()
52
53
53
54
c2 .SetReadLimit (1 << 30 )
54
55
@@ -63,12 +64,6 @@ func TestConn(t *testing.T) {
63
64
})
64
65
}
65
66
66
- type writerFunc func (p []byte ) (int , error )
67
-
68
- func (f writerFunc ) Write (p []byte ) (int , error ) {
69
- return f (p )
70
- }
71
-
72
67
// echoLoop echos every msg received from c until an error
73
68
// occurs or the context expires.
74
69
// The read limit is set to 1 << 30.
@@ -104,7 +99,7 @@ func echoLoop(ctx context.Context, c *websocket.Conn) error {
104
99
}
105
100
}
106
101
107
- func randBool (t testing.TB ) bool {
102
+ func randBool (t testing.TB ) bool {
108
103
return randInt (t , 2 ) == 1
109
104
}
110
105
@@ -117,7 +112,7 @@ func randInt(t testing.TB, max int) int {
117
112
type testHijacker struct {
118
113
* httptest.ResponseRecorder
119
114
serverConn net.Conn
120
- hijacked chan struct {}
115
+ hijacked chan struct {}
121
116
}
122
117
123
118
var _ http.Hijacker = testHijacker {}
@@ -154,7 +149,7 @@ type testTransport struct {
154
149
h http.HandlerFunc
155
150
}
156
151
157
- func (t testTransport ) RoundTrip (r * http.Request ) (* http.Response , error ) {
152
+ func (t testTransport ) RoundTrip (r * http.Request ) (* http.Response , error ) {
158
153
clientConn , serverConn := net .Pipe ()
159
154
160
155
hj := testHijacker {
0 commit comments