Jelajahi Sumber

test:listen

Shelikhoo 9 tahun lalu
induk
melakukan
02e3c17c97
1 mengubah file dengan 15 tambahan dan 0 penghapusan
  1. 15 0
      transport/internet/ws/ws_test.go

+ 15 - 0
transport/internet/ws/ws_test.go

@@ -107,3 +107,18 @@ func Test_Connect_wss_guess_reuse(t *testing.T) {
 		i--
 	}
 }
+
+func Test_listenWSAndDial(t *testing.T) {
+	assert := assert.On(t)
+	(&Config{Pto: "ws", Path: ""}).Apply()
+	listen, err := ListenWS(v2net.DomainAddress("localhost"), 13142)
+	assert.Error(err).IsNil()
+	go func() {
+		conn, err := listen.Accept()
+		assert.Error(err).IsNil()
+		conn.Close()
+	}()
+	conn, err := Dial(v2net.AnyIP, v2net.TCPDestination(v2net.DomainAddress("localhost"), 13142))
+	assert.Error(err).IsNil()
+	conn.Close()
+}