|
|
@@ -22,9 +22,13 @@ func TestHTTPConnection(t *testing.T) {
|
|
|
|
|
|
port := tcp.PickPort()
|
|
|
|
|
|
- listener, err := Listen(internet.ContextWithSecuritySettings(context.Background(), &tls.Config{
|
|
|
+ lctx := context.Background()
|
|
|
+ lctx = internet.ContextWithSecuritySettings(lctx, &tls.Config{
|
|
|
Certificate: []*tls.Certificate{tlsgen.GenerateCertificateForTest()},
|
|
|
- }), net.LocalHostIP, port, func(conn internet.Connection) {
|
|
|
+ })
|
|
|
+ lctx = internet.ContextWithTransportSettings(lctx, &Config{})
|
|
|
+
|
|
|
+ listener, err := Listen(lctx, net.LocalHostIP, port, func(conn internet.Connection) {
|
|
|
go func() {
|
|
|
defer conn.Close()
|
|
|
|
|
|
@@ -47,10 +51,13 @@ func TestHTTPConnection(t *testing.T) {
|
|
|
|
|
|
time.Sleep(time.Second)
|
|
|
|
|
|
- conn, err := Dial(internet.ContextWithSecuritySettings(context.Background(), &tls.Config{
|
|
|
+ dctx := context.Background()
|
|
|
+ dctx = internet.ContextWithSecuritySettings(dctx, &tls.Config{
|
|
|
ServerName: "www.v2ray.com",
|
|
|
AllowInsecure: true,
|
|
|
- }), net.TCPDestination(net.LocalHostIP, port))
|
|
|
+ })
|
|
|
+ dctx = internet.ContextWithTransportSettings(dctx, &Config{})
|
|
|
+ conn, err := Dial(dctx, net.TCPDestination(net.LocalHostIP, port))
|
|
|
assert(err, IsNil)
|
|
|
defer conn.Close()
|
|
|
|