mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-21 09:36:34 -05:00
Fix test
This commit is contained in:
parent
890d185979
commit
4bc91b0215
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user