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

remove sock4 tests

This commit is contained in:
Darien Raymond 2017-01-08 01:15:29 +01:00
parent f2e9d8a4e0
commit a54f1da049
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -4,7 +4,6 @@ import (
"net"
"testing"
socks1 "h12.me/socks"
"v2ray.com/core"
v2net "v2ray.com/core/common/net"
"v2ray.com/core/common/protocol"
@ -110,56 +109,6 @@ func TestSocksBridgeTCP(t *testing.T) {
CloseAllServers()
}
func TestSocks4(t *testing.T) {
assert := assert.On(t)
tcpServer := tcp.Server{
MsgProcessor: xor,
}
dest, err := tcpServer.Start()
assert.Error(err).IsNil()
defer tcpServer.Close()
serverPort := pickPort()
serverConfig := &core.Config{
Inbound: []*core.InboundConnectionConfig{
{
PortRange: v2net.SinglePortRange(serverPort),
ListenOn: v2net.NewIPOrDomain(v2net.LocalHostIP),
Settings: serial.ToTypedMessage(&socks.ServerConfig{
AuthType: socks.AuthType_NO_AUTH,
Address: v2net.NewIPOrDomain(v2net.LocalHostIP),
UdpEnabled: false,
}),
},
},
Outbound: []*core.OutboundConnectionConfig{
{
Settings: serial.ToTypedMessage(&freedom.Config{}),
},
},
}
assert.Error(InitializeServerConfig(serverConfig)).IsNil()
dialer := socks1.DialSocksProxy(socks1.SOCKS4, v2net.TCPDestination(v2net.LocalHostIP, serverPort).NetAddr())
conn, err := dialer("tcp", dest.NetAddr())
assert.Error(err).IsNil()
payload := "test payload"
nBytes, err := conn.Write([]byte(payload))
assert.Error(err).IsNil()
assert.Int(nBytes).Equals(len(payload))
response := make([]byte, 1024)
nBytes, err = conn.Read(response)
assert.Error(err).IsNil()
assert.Bytes(response[:nBytes]).Equals(xor([]byte(payload)))
assert.Error(conn.Close()).IsNil()
CloseAllServers()
}
func TestSocksBridageUDP(t *testing.T) {
assert := assert.On(t)