banner_test.go 699 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright 2014 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // +build aix darwin dragonfly freebsd linux netbsd openbsd
  5. package test
  6. import (
  7. "testing"
  8. )
  9. func TestBannerCallbackAgainstOpenSSH(t *testing.T) {
  10. server := newServer(t)
  11. defer server.Shutdown()
  12. clientConf := clientConfig()
  13. var receivedBanner string
  14. clientConf.BannerCallback = func(message string) error {
  15. receivedBanner = message
  16. return nil
  17. }
  18. conn := server.Dial(clientConf)
  19. defer conn.Close()
  20. expected := "Server Banner"
  21. if receivedBanner != expected {
  22. t.Fatalf("got %v; want %v", receivedBanner, expected)
  23. }
  24. }