From d1e990d46e2317cdd4c753715c62f11447f19fd6 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Fri, 5 Feb 2016 10:38:45 +0000 Subject: [PATCH] test case for shadowsocks ota --- proxy/shadowsocks/ota_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 proxy/shadowsocks/ota_test.go diff --git a/proxy/shadowsocks/ota_test.go b/proxy/shadowsocks/ota_test.go new file mode 100644 index 00000000..44564ea9 --- /dev/null +++ b/proxy/shadowsocks/ota_test.go @@ -0,0 +1,22 @@ +package shadowsocks_test + +import ( + "testing" + + "github.com/v2ray/v2ray-core/common/alloc" + . "github.com/v2ray/v2ray-core/proxy/shadowsocks" + v2testing "github.com/v2ray/v2ray-core/testing" + "github.com/v2ray/v2ray-core/testing/assert" +) + +func TestNormalChunkReading(t *testing.T) { + v2testing.Current(t) + + buffer := alloc.NewBuffer().Clear().AppendBytes( + 0, 8, 39, 228, 69, 96, 133, 39, 254, 26, 201, 70, 11, 12, 13, 14, 15, 16, 17, 18) + reader := NewChunkReader(buffer, NewAuthenticator(ChunkKeyGenerator( + []byte{21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36}))) + payload, err := reader.Read() + assert.Error(err).IsNil() + assert.Bytes(payload.Value).Equals([]byte{11, 12, 13, 14, 15, 16, 17, 18}) +}