github.com/psiphon-Labs/psiphon-tunnel-core@v2.0.28+incompatible/psiphon/common/crypto/ssh/test/banner_test.go (about) 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 5 //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd 6 // +build aix darwin dragonfly freebsd linux netbsd openbsd 7 8 package test 9 10 import ( 11 "testing" 12 ) 13 14 func TestBannerCallbackAgainstOpenSSH(t *testing.T) { 15 server := newServer(t) 16 defer server.Shutdown() 17 18 clientConf := clientConfig() 19 20 var receivedBanner string 21 clientConf.BannerCallback = func(message string) error { 22 receivedBanner = message 23 return nil 24 } 25 26 conn := server.Dial(clientConf) 27 defer conn.Close() 28 29 expected := "Server Banner" 30 if receivedBanner != expected { 31 t.Fatalf("got %v; want %v", receivedBanner, expected) 32 } 33 }