From 7c702b576833c24bd2d646935dfaebc83b2785a5 Mon Sep 17 00:00:00 2001 From: David Stainton Date: Mon, 30 May 2016 21:16:11 +0000 Subject: [PATCH] Fix test so that client sends a response and we verify the service gets it --- socks_server_chain_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/socks_server_chain_test.go b/socks_server_chain_test.go index b49f7b2..2a7cd5e 100644 --- a/socks_server_chain_test.go +++ b/socks_server_chain_test.go @@ -31,6 +31,7 @@ func NewAccumulatingService(net, address, banner string) *AccumulatingService { banner: banner, hasProtocolInfo: true, hasAuthenticate: true, + receivedChan: make(chan bool, 0), } return &l } @@ -158,5 +159,15 @@ func TestSocksServerProxyChain(t *testing.T) { } if string(line) != banner { t.Errorf("Did not receive expected banner. Got %s, wanted %s\n", string(line), banner) + t.Fail() + } + + // send the service some data and verify it was received + clientData := "hello world\r\n" + conn.Write([]byte(clientData)) + service.WaitUntilReceived() + if service.buffer.String() != strings.TrimSpace(clientData)+"\n" { + t.Errorf("Client sent %s but service only received %s\n", "hello world\n", service.buffer.String()) + t.Fail() } }