From 4bc91b0215b53e7f5129803b11c14f799916ae06 Mon Sep 17 00:00:00 2001 From: V2Ray Date: Wed, 14 Oct 2015 14:56:11 +0200 Subject: [PATCH] Fix test --- proxy/freedom/freedom_test.go | 9 +++++---- proxy/socks/socks_test.go | 23 ++++++++++++----------- proxy/vmess/vmess_test.go | 19 ++++++++++--------- 3 files changed, 27 insertions(+), 24 deletions(-) diff --git a/proxy/freedom/freedom_test.go b/proxy/freedom/freedom_test.go index 87f44c1f7..7d424bebd 100644 --- a/proxy/freedom/freedom_test.go +++ b/proxy/freedom/freedom_test.go @@ -8,9 +8,10 @@ import ( "golang.org/x/net/proxy" - "github.com/v2ray/v2ray-core" + "github.com/v2ray/v2ray-core/app/point" "github.com/v2ray/v2ray-core/common/alloc" v2net "github.com/v2ray/v2ray-core/common/net" + v2proxy "github.com/v2ray/v2ray-core/proxy" _ "github.com/v2ray/v2ray-core/proxy/socks" "github.com/v2ray/v2ray-core/proxy/socks/config/json" "github.com/v2ray/v2ray-core/testing/mocks" @@ -42,7 +43,7 @@ func TestUDPSend(t *testing.T) { DataReturned: bytes.NewBuffer(make([]byte, 0, 1024)), } - core.RegisterInboundConnectionHandlerFactory("mock_ich", ich) + v2proxy.RegisterInboundConnectionHandlerFactory("mock_ich", ich) pointPort := uint16(38724) config := mocks.Config{ @@ -57,7 +58,7 @@ func TestUDPSend(t *testing.T) { }, } - point, err := core.NewPoint(&config) + point, err := point.NewPoint(&config) assert.Error(err).IsNil() err = point.Start() @@ -104,7 +105,7 @@ func TestSocksTcpConnect(t *testing.T) { }, } - point, err := core.NewPoint(&config) + point, err := point.NewPoint(&config) assert.Error(err).IsNil() err = point.Start() diff --git a/proxy/socks/socks_test.go b/proxy/socks/socks_test.go index 3fd27c2b4..8975be41c 100644 --- a/proxy/socks/socks_test.go +++ b/proxy/socks/socks_test.go @@ -8,7 +8,8 @@ import ( "golang.org/x/net/proxy" - "github.com/v2ray/v2ray-core" + "github.com/v2ray/v2ray-core/app/point" + v2proxy "github.com/v2ray/v2ray-core/proxy" "github.com/v2ray/v2ray-core/proxy/socks/config/json" "github.com/v2ray/v2ray-core/testing/mocks" "github.com/v2ray/v2ray-core/testing/unit" @@ -23,7 +24,7 @@ func TestSocksTcpConnect(t *testing.T) { Data2Return: []byte("The data to be returned to socks server."), } - core.RegisterOutboundConnectionHandlerFactory("mock_och", och) + v2proxy.RegisterOutboundConnectionHandlerFactory("mock_och", och) config := mocks.Config{ PortValue: port, @@ -39,7 +40,7 @@ func TestSocksTcpConnect(t *testing.T) { }, } - point, err := core.NewPoint(&config) + point, err := point.NewPoint(&config) assert.Error(err).IsNil() err = point.Start() @@ -76,7 +77,7 @@ func TestSocksTcpConnectWithUserPass(t *testing.T) { Data2Return: []byte("The data to be returned to socks server."), } - core.RegisterOutboundConnectionHandlerFactory("mock_och", och) + v2proxy.RegisterOutboundConnectionHandlerFactory("mock_och", och) config := mocks.Config{ PortValue: port, @@ -98,7 +99,7 @@ func TestSocksTcpConnectWithUserPass(t *testing.T) { }, } - point, err := core.NewPoint(&config) + point, err := point.NewPoint(&config) assert.Error(err).IsNil() err = point.Start() @@ -135,7 +136,7 @@ func TestSocksTcpConnectWithWrongUserPass(t *testing.T) { Data2Return: []byte("The data to be returned to socks server."), } - core.RegisterOutboundConnectionHandlerFactory("mock_och", och) + v2proxy.RegisterOutboundConnectionHandlerFactory("mock_och", och) config := mocks.Config{ PortValue: port, @@ -157,7 +158,7 @@ func TestSocksTcpConnectWithWrongUserPass(t *testing.T) { }, } - point, err := core.NewPoint(&config) + point, err := point.NewPoint(&config) assert.Error(err).IsNil() err = point.Start() @@ -180,7 +181,7 @@ func TestSocksTcpConnectWithWrongAuthMethod(t *testing.T) { Data2Return: []byte("The data to be returned to socks server."), } - core.RegisterOutboundConnectionHandlerFactory("mock_och", och) + v2proxy.RegisterOutboundConnectionHandlerFactory("mock_och", och) config := mocks.Config{ PortValue: port, @@ -202,7 +203,7 @@ func TestSocksTcpConnectWithWrongAuthMethod(t *testing.T) { }, } - point, err := core.NewPoint(&config) + point, err := point.NewPoint(&config) assert.Error(err).IsNil() err = point.Start() @@ -225,7 +226,7 @@ func TestSocksUdpSend(t *testing.T) { Data2Return: []byte("The data to be returned to socks server."), } - core.RegisterOutboundConnectionHandlerFactory("mock_och", och) + v2proxy.RegisterOutboundConnectionHandlerFactory("mock_och", och) config := mocks.Config{ PortValue: port, @@ -242,7 +243,7 @@ func TestSocksUdpSend(t *testing.T) { }, } - point, err := core.NewPoint(&config) + point, err := point.NewPoint(&config) assert.Error(err).IsNil() err = point.Start() diff --git a/proxy/vmess/vmess_test.go b/proxy/vmess/vmess_test.go index 6d9d0e45a..de1704313 100644 --- a/proxy/vmess/vmess_test.go +++ b/proxy/vmess/vmess_test.go @@ -4,9 +4,10 @@ import ( "bytes" "testing" - "github.com/v2ray/v2ray-core" + "github.com/v2ray/v2ray-core/app/point" "github.com/v2ray/v2ray-core/common/alloc" v2net "github.com/v2ray/v2ray-core/common/net" + "github.com/v2ray/v2ray-core/proxy" "github.com/v2ray/v2ray-core/testing/mocks" "github.com/v2ray/v2ray-core/testing/unit" ) @@ -22,7 +23,7 @@ func TestVMessInAndOut(t *testing.T) { DataReturned: bytes.NewBuffer(make([]byte, 0, 1024)), } - core.RegisterInboundConnectionHandlerFactory("mock_ich", ich) + proxy.RegisterInboundConnectionHandlerFactory("mock_ich", ich) configA := mocks.Config{ PortValue: portA, @@ -47,7 +48,7 @@ func TestVMessInAndOut(t *testing.T) { }, } - pointA, err := core.NewPoint(&configA) + pointA, err := point.NewPoint(&configA) assert.Error(err).IsNil() err = pointA.Start() @@ -60,7 +61,7 @@ func TestVMessInAndOut(t *testing.T) { Data2Return: []byte("The data to be returned to inbound server."), } - core.RegisterOutboundConnectionHandlerFactory("mock_och", och) + proxy.RegisterOutboundConnectionHandlerFactory("mock_och", och) configB := mocks.Config{ PortValue: portB, @@ -78,7 +79,7 @@ func TestVMessInAndOut(t *testing.T) { }, } - pointB, err := core.NewPoint(&configB) + pointB, err := point.NewPoint(&configB) assert.Error(err).IsNil() err = pointB.Start() @@ -101,7 +102,7 @@ func TestVMessInAndOutUDP(t *testing.T) { DataReturned: bytes.NewBuffer(make([]byte, 0, 1024)), } - core.RegisterInboundConnectionHandlerFactory("mock_ich", ich) + proxy.RegisterInboundConnectionHandlerFactory("mock_ich", ich) configA := mocks.Config{ PortValue: portA, @@ -126,7 +127,7 @@ func TestVMessInAndOutUDP(t *testing.T) { }, } - pointA, err := core.NewPoint(&configA) + pointA, err := point.NewPoint(&configA) assert.Error(err).IsNil() err = pointA.Start() @@ -139,7 +140,7 @@ func TestVMessInAndOutUDP(t *testing.T) { Data2Return: []byte("The data to be returned to inbound server."), } - core.RegisterOutboundConnectionHandlerFactory("mock_och", och) + proxy.RegisterOutboundConnectionHandlerFactory("mock_och", och) configB := mocks.Config{ PortValue: portB, @@ -158,7 +159,7 @@ func TestVMessInAndOutUDP(t *testing.T) { }, } - pointB, err := core.NewPoint(&configB) + pointB, err := point.NewPoint(&configB) assert.Error(err).IsNil() err = pointB.Start()