@@ -88,7 +88,7 @@ const ca = readKey('fake-startcom-root-cert.pem', 'binary');
88
88
[ 'https://example.org' , 'https://example.com' ]
89
89
] ;
90
90
91
- const countdown = new Countdown ( 2 , ( ) => {
91
+ const countdown = new Countdown ( 3 , ( ) => {
92
92
client . close ( ) ;
93
93
server . close ( ) ;
94
94
} ) ;
@@ -101,7 +101,7 @@ const ca = readKey('fake-startcom-root-cert.pem', 'binary');
101
101
countdown . dec ( ) ;
102
102
} , 2 ) ) ;
103
103
104
- client . request ( ) . on ( 'close' , mustCall ( ) ) . resume ( ) ;
104
+ client . request ( ) . on ( 'close' , mustCall ( ( ) => countdown . dec ( ) ) ) . resume ( ) ;
105
105
} ) ) ;
106
106
}
107
107
@@ -119,15 +119,19 @@ const ca = readKey('fake-startcom-root-cert.pem', 'binary');
119
119
const originSet = [ `https://localhost:${ server . address ( ) . port } ` ] ;
120
120
const client = connect ( originSet [ 0 ] , { ca } ) ;
121
121
122
+ const countdown = new Countdown ( 2 , ( ) => {
123
+ client . close ( ) ;
124
+ server . close ( ) ;
125
+ } ) ;
126
+
122
127
client . on ( 'origin' , mustCall ( ( origins ) => {
123
128
originSet . push ( ...check ) ;
124
129
deepStrictEqual ( originSet , client . originSet ) ;
125
130
deepStrictEqual ( origins , check ) ;
126
- client . close ( ) ;
127
- server . close ( ) ;
131
+ countdown . dec ( ) ;
128
132
} ) ) ;
129
133
130
- client . request ( ) . on ( 'close' , mustCall ( ) ) . resume ( ) ;
134
+ client . request ( ) . on ( 'close' , mustCall ( ( ) => countdown . dec ( ) ) ) . resume ( ) ;
131
135
} ) ) ;
132
136
}
133
137
0 commit comments