@@ -88,7 +88,7 @@ const ca = readKey('fake-startcom-root-cert.pem', 'binary');
8888 [ 'https://example.org' , 'https://example.com' ]
8989 ] ;
9090
91- const countdown = new Countdown ( 2 , ( ) => {
91+ const countdown = new Countdown ( 3 , ( ) => {
9292 client . close ( ) ;
9393 server . close ( ) ;
9494 } ) ;
@@ -101,7 +101,7 @@ const ca = readKey('fake-startcom-root-cert.pem', 'binary');
101101 countdown . dec ( ) ;
102102 } , 2 ) ) ;
103103
104- client . request ( ) . on ( 'close' , mustCall ( ) ) . resume ( ) ;
104+ client . request ( ) . on ( 'close' , mustCall ( ( ) => countdown . dec ( ) ) ) . resume ( ) ;
105105 } ) ) ;
106106}
107107
@@ -119,15 +119,19 @@ const ca = readKey('fake-startcom-root-cert.pem', 'binary');
119119 const originSet = [ `https://localhost:${ server . address ( ) . port } ` ] ;
120120 const client = connect ( originSet [ 0 ] , { ca } ) ;
121121
122+ const countdown = new Countdown ( 2 , ( ) => {
123+ client . close ( ) ;
124+ server . close ( ) ;
125+ } ) ;
126+
122127 client . on ( 'origin' , mustCall ( ( origins ) => {
123128 originSet . push ( ...check ) ;
124129 deepStrictEqual ( originSet , client . originSet ) ;
125130 deepStrictEqual ( origins , check ) ;
126- client . close ( ) ;
127- server . close ( ) ;
131+ countdown . dec ( ) ;
128132 } ) ) ;
129133
130- client . request ( ) . on ( 'close' , mustCall ( ) ) . resume ( ) ;
134+ client . request ( ) . on ( 'close' , mustCall ( ( ) => countdown . dec ( ) ) ) . resume ( ) ;
131135 } ) ) ;
132136}
133137
0 commit comments