127
// TODO(hanwen): test that closing the connection also
128
// exits the listeners.
127
// Check that listeners exit if the underlying client transport dies.
128
func TestPortForwardConnectionClose(t *testing.T) {
129
server := newServer(t)
130
defer server.Shutdown()
131
conn := server.Dial(clientConfig())
133
sshListener, err := conn.Listen("tcp", "localhost:0")
138
quit := make(chan error, 1)
141
c, err := sshListener.Accept()
150
// It would be even nicer if we closed the server side, but it
151
// is more involved as the fd for that side is dup()ed.
152
server.clientConn.Close()
155
case <-time.After(1 * time.Second):
156
t.Errorf("timeout: listener did not close.")
158
t.Logf("quit as expected (error %v)", err)