go-hep.org/x/hep@v0.38.1/xrootd/protocol_test.go (about) 1 // Copyright ©2018 The go-hep 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 package xrootd 6 7 import ( 8 "context" 9 "reflect" 10 "testing" 11 12 "go-hep.org/x/hep/xrootd/xrdproto/protocol" 13 ) 14 15 func testSession_Protocol(t *testing.T, addr string) { 16 want := protocol.Response{BinaryProtocolVersion: 784, Flags: protocol.IsServer} 17 18 session, err := newSession(context.Background(), addr, "gopher", "", nil) 19 if err != nil { 20 t.Fatalf("could not create initialSession: %v", err) 21 } 22 defer session.Close() 23 24 got, err := session.Protocol(context.Background()) 25 if err != nil { 26 t.Fatalf("invalid protocol call: %v", err) 27 } 28 if !reflect.DeepEqual(got, want) { 29 t.Errorf("session.Protocol()\ngot = %v\nwant = %v", got, want) 30 } 31 } 32 33 func TestSession_Protocol(t *testing.T) { 34 for _, addr := range testClientAddrs { 35 t.Run(addr, func(t *testing.T) { 36 testSession_Protocol(t, addr) 37 }) 38 } 39 }