INNER CODE UNIT · Go
TestStream
yahoo/vssh · client_test.go:311
func TestStream(t *testing.T) {
vs := New().Start()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
timeout, _ := time.ParseDuration("6s")
config := GetConfigUserPass("vssh", "vssh")
vs.AddClient(testSrvAddr, config, SetMaxSessions(2), DisableRequestPty())
vs.Wait()
respChan := vs.Run(ctx, "ping", timeout)
resp := <-respChan
stream := resp.GetStream()
defer stream.Close()
counter := 0
for stream.ScanStdout() {
stream.BytesStdout()