@@ -14,6 +14,7 @@ import (
14
14
"github.com/xtls/xray-core/common/net"
15
15
"github.com/xtls/xray-core/common/protocol/tls/cert"
16
16
"github.com/xtls/xray-core/testing/servers/tcp"
17
+ "github.com/xtls/xray-core/testing/servers/udp"
17
18
"github.com/xtls/xray-core/transport/internet"
18
19
. "github.com/xtls/xray-core/transport/internet/splithttp"
19
20
"github.com/xtls/xray-core/transport/internet/stat"
@@ -204,3 +205,42 @@ func Test_listenSHAndDial_H2C(t *testing.T) {
204
205
t .Error ("Expected h2 but got:" , resp .ProtoMajor )
205
206
}
206
207
}
208
+
209
+ func Test_listenSHAndDial_QUIC (t * testing.T ) {
210
+ if runtime .GOARCH == "arm64" {
211
+ return
212
+ }
213
+
214
+ listenPort := udp .PickPort ()
215
+
216
+ start := time .Now ()
217
+
218
+ streamSettings := & internet.MemoryStreamConfig {
219
+ ProtocolName : "splithttp" ,
220
+ ProtocolSettings : & Config {
221
+ Path : "shs" ,
222
+ },
223
+ SecurityType : "tls" ,
224
+ SecuritySettings : & tls.Config {
225
+ AllowInsecure : true ,
226
+ Certificate : []* tls.Certificate {tls .ParseCertificate (cert .MustGenerate (nil , cert .CommonName ("localhost" )))},
227
+ NextProtocol : []string {"h3" },
228
+ },
229
+ }
230
+ listen , err := ListenSH (context .Background (), net .LocalHostIP , listenPort , streamSettings , func (conn stat.Connection ) {
231
+ go func () {
232
+ _ = conn .Close ()
233
+ }()
234
+ })
235
+ common .Must (err )
236
+ defer listen .Close ()
237
+
238
+ conn , err := Dial (context .Background (), net .UDPDestination (net .DomainAddress ("localhost" ), listenPort ), streamSettings )
239
+ common .Must (err )
240
+ _ = conn .Close ()
241
+
242
+ end := time .Now ()
243
+ if ! end .Before (start .Add (time .Second * 5 )) {
244
+ t .Error ("end: " , end , " start: " , start )
245
+ }
246
+ }
0 commit comments