...

Source file src/golang.org/x/crypto/ssh/test/banner_test.go

Documentation: golang.org/x/crypto/ssh/test

     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 || solaris
     6  
     7  package test
     8  
     9  import (
    10  	"testing"
    11  )
    12  
    13  func TestBannerCallbackAgainstOpenSSH(t *testing.T) {
    14  	server := newServer(t)
    15  
    16  	clientConf := clientConfig()
    17  
    18  	var receivedBanner string
    19  	clientConf.BannerCallback = func(message string) error {
    20  		receivedBanner = message
    21  		return nil
    22  	}
    23  
    24  	conn := server.Dial(clientConf)
    25  	defer conn.Close()
    26  
    27  	expected := "Server Banner"
    28  	if receivedBanner != expected {
    29  		t.Fatalf("got %v; want %v", receivedBanner, expected)
    30  	}
    31  }
    32  

View as plain text