~juju-qa/ubuntu/xenial/juju/2.0-rc2

« back to all changes in this revision

Viewing changes to src/golang.org/x/crypto/ssh/mux_test.go

  • Committer: Nicholas Skaggs
  • Date: 2016-09-30 14:39:30 UTC
  • mfrom: (1.8.1)
  • Revision ID: nicholas.skaggs@canonical.com-20160930143930-vwwhrefh6ftckccy
import upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
331
331
                        ok, data, err)
332
332
        }
333
333
 
334
 
        clientMux.Disconnect(0, "")
335
334
        if !seen {
336
335
                t.Errorf("never saw 'peek' request")
337
336
        }
378
377
        }
379
378
}
380
379
 
381
 
func TestMuxDisconnect(t *testing.T) {
382
 
        a, b := muxPair()
383
 
        defer a.Close()
384
 
        defer b.Close()
385
 
 
386
 
        go func() {
387
 
                for r := range b.incomingRequests {
388
 
                        r.Reply(true, nil)
389
 
                }
390
 
        }()
391
 
 
392
 
        a.Disconnect(42, "whatever")
393
 
        ok, _, err := a.SendRequest("hello", true, nil)
394
 
        if ok || err == nil {
395
 
                t.Errorf("got reply after disconnecting")
396
 
        }
397
 
        err = b.Wait()
398
 
        if d, ok := err.(*disconnectMsg); !ok || d.Reason != 42 {
399
 
                t.Errorf("got %#v, want disconnectMsg{Reason:42}", err)
400
 
        }
401
 
}
402
 
 
403
380
func TestMuxCloseChannel(t *testing.T) {
404
381
        r, w, mux := channelPair(t)
405
382
        defer mux.Close()