From 07b440fdcb81a06f1a415dbab2460fdc4f077d84 Mon Sep 17 00:00:00 2001 From: V2Ray Date: Mon, 7 Sep 2015 17:28:36 +0200 Subject: [PATCH] Test case for auth response tobytes --- io/socks/socks_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 io/socks/socks_test.go diff --git a/io/socks/socks_test.go b/io/socks/socks_test.go new file mode 100644 index 000000000..3ec7c5835 --- /dev/null +++ b/io/socks/socks_test.go @@ -0,0 +1,18 @@ +package socks + +import ( + "testing" +) + +func TestAuthenticationResponseToBytes(t *testing.T) { + socksVersion := uint8(5) + authMethod := uint8(1) + response := Socks5AuthenticationResponse{socksVersion, authMethod} + bytes := response.ToBytes() + if bytes[0] != socksVersion { + t.Errorf("Unexpected Socks version %d", bytes[0]) + } + if bytes[1] != authMethod { + t.Errorf("Unexpected Socks auth method %d", bytes[1]) + } +}