1
1
import { Http3Server , WebTransport } from "@fails-components/webtransport" ;
2
- import { Http3EventLoop } from "@fails-components/webtransport/lib/event-loop.js" ;
3
2
import expect from "expect.js" ;
4
3
import { Server } from "engine.io" ;
5
4
import { Socket } from "../build/esm-debug/index.js" ;
@@ -16,7 +15,7 @@ async function setup(opts, cb) {
16
15
const certificate = await generateWebTransportCertificate (
17
16
[ { shortName : "CN" , value : "localhost" } ] ,
18
17
{
19
- days : 14 , // the total length of the validity period MUST NOT exceed two weeks (https://w3c.github.io/webtransport/#custom-certificate-requirements)
18
+ days : 13 , // the total length of the validity period MUST NOT exceed two weeks (https://w3c.github.io/webtransport/#custom-certificate-requirements)
20
19
} ,
21
20
) ;
22
21
@@ -48,7 +47,10 @@ async function setup(opts, cb) {
48
47
} ) ( ) ;
49
48
50
49
h3Server . startServer ( ) ;
51
- h3Server . onServerListening = ( ) => cb ( { engine, h3Server, certificate } ) ;
50
+
51
+ await h3Server . ready ;
52
+
53
+ cb ( { engine, h3Server, certificate } ) ;
52
54
}
53
55
54
56
function success ( engine , h3server , done ) {
@@ -79,10 +81,6 @@ function createSocket(port, certificate, opts) {
79
81
}
80
82
81
83
describe ( "WebTransport" , ( ) => {
82
- after ( ( ) => {
83
- Http3EventLoop . globalLoop . shutdownEventLoop ( ) ; // manually shutdown the event loop, instead of waiting 20s
84
- } ) ;
85
-
86
84
it ( "should allow to connect with WebTransport directly" , ( done ) => {
87
85
setup ( { } , ( { engine, h3Server, certificate } ) => {
88
86
const socket = createSocket ( h3Server . port , certificate , {
0 commit comments