1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-30 05:56:54 -05:00

test case for shadowsocks as inbound detour

This commit is contained in:
v2ray 2016-02-16 14:28:39 +01:00
parent 8daa427daf
commit f7c6ecde90
2 changed files with 30 additions and 0 deletions

View File

@ -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": {}

View File

@ -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()
}