From f7c6ecde902a39e93f85ebfd786efd6457606f43 Mon Sep 17 00:00:00 2001 From: v2ray Date: Tue, 16 Feb 2016 14:28:39 +0100 Subject: [PATCH] test case for shadowsocks as inbound detour --- testing/scenarios/data/test_6_server.json | 11 +++++++++++ testing/scenarios/shadowsocks_test.go | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/testing/scenarios/data/test_6_server.json b/testing/scenarios/data/test_6_server.json index 5c7d4dbce..d1993375c 100644 --- a/testing/scenarios/data/test_6_server.json +++ b/testing/scenarios/data/test_6_server.json @@ -7,6 +7,17 @@ "password": "v2ray-password" } }, + "inboundDetour": [ + { + "protocol": "shadowsocks", + "port": 50055, + "settings": { + "method": "aes-128-cfb", + "password": "v2ray-another", + "udp": true + } + } + ], "outbound": { "protocol": "freedom", "settings": {} diff --git a/testing/scenarios/shadowsocks_test.go b/testing/scenarios/shadowsocks_test.go index 3ea107d1f..fa1ab3245 100644 --- a/testing/scenarios/shadowsocks_test.go +++ b/testing/scenarios/shadowsocks_test.go @@ -50,5 +50,24 @@ func TestShadowsocksTCP(t *testing.T) { assert.StringLiteral("Processed: " + payload).Equals(string(response[:nBytes])) conn.Close() + cipher, err = ssclient.NewCipher("aes-128-cfb", "v2ray-another") + assert.Error(err).IsNil() + + conn, err = ssclient.DialWithRawAddr(rawAddr, "127.0.0.1:50055", cipher) + assert.Error(err).IsNil() + + payload = "shadowsocks request 2." + nBytes, err = conn.Write([]byte(payload)) + assert.Error(err).IsNil() + assert.Int(nBytes).Equals(len(payload)) + + conn.Conn.(*net.TCPConn).CloseWrite() + + response = make([]byte, 1024) + nBytes, err = conn.Read(response) + assert.Error(err).IsNil() + assert.StringLiteral("Processed: " + payload).Equals(string(response[:nBytes])) + conn.Close() + CloseAllServers() }