MCPcopy
hub / github.com/gliderlabs/ssh / TestConnWrapping

Function TestConnWrapping

options_test.go:83–109  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

81}
82
83func 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}

Callers

nothing calls this directly

Calls 3

PasswordAuthFunction · 0.85
WrapConnFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…