@@ -39,11 +39,11 @@ func Test_hijacking(t *testing.T) {
3939 t .Cleanup (func () { l .Close () })
4040
4141 httpMux := http .NewServeMux ()
42- ch := make (chan io.ReadWriteCloser )
42+ ch := make (chan io.ReadWriter )
4343 wait := make (chan struct {})
4444 once := sync .OnceFunc (func () { close (wait ) })
4545 defer once ()
46- httpMux .Handle (NewHijackAcceptor (testhelper .TestLogger (t ), func (_ context.Context , closer io.ReadWriteCloser ) {
46+ httpMux .Handle (NewHijackAcceptor (testhelper .TestLogger (t ), func (_ context.Context , closer io.ReadWriter ) {
4747 ch <- closer
4848 <- wait
4949 }))
@@ -68,7 +68,6 @@ func Test_hijacking(t *testing.T) {
6868 assert .Equal (t , "ping" , readLine (connServer ))
6969 assert .NoError (t , writeLine (connServer , "pong" ))
7070 assert .Equal (t , "pong" , readLine (connHijacked ))
71- assert .NoError (t , connServer .Close ())
7271 assert .NoError (t , connHijacked .Close ())
7372 once ()
7473
@@ -93,7 +92,7 @@ func TestHijackify_hijackRequest_timeout(t *testing.T) {
9392 assert .ErrorContains (t , err , "i/o timeout" )
9493}
9594
96- func readLine (conn io.ReadWriteCloser ) string {
95+ func readLine (conn io.Reader ) string {
9796 r := bufio .NewReader (conn )
9897 line , err := r .ReadString ('\n' )
9998 if err != nil {
@@ -102,7 +101,7 @@ func readLine(conn io.ReadWriteCloser) string {
102101 return strings .TrimRight (line , "\r \n " )
103102}
104103
105- func writeLine (conn io.ReadWriteCloser , line string ) error {
104+ func writeLine (conn io.Writer , line string ) error {
106105 _ , err := conn .Write ([]byte (line + "\r \n " ))
107106 return err
108107}
0 commit comments