@@ -5,6 +5,7 @@ if (!common.hasCrypto)
55 common . skip ( 'missing crypto' ) ;
66const assert = require ( 'assert' ) ;
77const h2 = require ( 'http2' ) ;
8+ const Countdown = require ( '../common/countdown' ) ;
89
910// Calling .destroy() on the socket proxy must not throw
1011// (previously threw ERR_HTTP2_NO_SOCKET_MANIPULATION) and must
@@ -17,6 +18,8 @@ server.on('stream', common.mustCall(function(stream) {
1718 stream . end ( 'ok' ) ;
1819} , 2 ) ) ;
1920
21+ const countdown = new Countdown ( 2 , ( ) => server . close ( ) ) ;
22+
2023server . listen ( 0 , common . mustCall ( ( ) => {
2124 const port = server . address ( ) . port ;
2225
@@ -33,6 +36,7 @@ server.listen(0, common.mustCall(() => {
3336 assert . strictEqual ( client . socket , undefined ) ;
3437 // Destroying again through a stale proxy reference must not throw.
3538 socket . destroy ( ) ;
39+ countdown . dec ( ) ;
3640 } ) ) ;
3741 } ) ) ;
3842 client . on ( 'error' , common . mustNotCall ( ) ) ;
@@ -51,7 +55,7 @@ server.listen(0, common.mustCall(() => {
5155 assert . strictEqual ( err . message , 'boom' ) ;
5256 } ) ) ;
5357 client . on ( 'close' , common . mustCall ( ( ) => {
54- server . close ( ) ;
58+ countdown . dec ( ) ;
5559 } ) ) ;
5660 }
5761} ) ) ;
0 commit comments