(t *testing.T)
| 81 | } |
| 82 | |
| 83 | func TestConnWrapping(t *testing.T) { |
| 84 | t.Parallel() |
| 85 | var wrapped *wrappedConn |
| 86 | session, _, cleanup := newTestSessionWithOptions(t, &Server{ |
| 87 | Handler: func(s Session) { |
| 88 | // nothing |
| 89 | }, |
| 90 | }, &gossh.ClientConfig{ |
| 91 | User: "testuser", |
| 92 | Auth: []gossh.AuthMethod{ |
| 93 | gossh.Password("testpass"), |
| 94 | }, |
| 95 | HostKeyCallback: gossh.InsecureIgnoreHostKey(), |
| 96 | }, PasswordAuth(func(ctx Context, password string) bool { |
| 97 | return true |
| 98 | }), WrapConn(func(ctx Context, conn net.Conn) net.Conn { |
| 99 | wrapped = &wrappedConn{conn, 0} |
| 100 | return wrapped |
| 101 | })) |
| 102 | defer cleanup() |
| 103 | if err := session.Shell(); err != nil { |
| 104 | t.Fatal(err) |
| 105 | } |
| 106 | if atomic.LoadInt32(&(wrapped.written)) == 0 { |
| 107 | t.Fatal("wrapped conn not written to") |
| 108 | } |
| 109 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…