1'use strict'; 2 3const common = require('../common'); 4if (!common.hasCrypto) 5 common.skip('missing crypto'); 6 7const Countdown = require('../common/countdown'); 8const http2 = require('http2'); 9 10const server = http2.createServer(); 11 12let session; 13 14const countdown = new Countdown(2, () => { 15 server.close(common.mustSucceed()); 16 session.destroy(); 17}); 18 19server.listen(0, common.mustCall(() => { 20 const client = http2.connect(`http://localhost:${server.address().port}`); 21 client.on('connect', common.mustCall(() => countdown.dec())); 22})); 23 24server.on('session', common.mustCall((s) => { 25 session = s; 26 countdown.dec(); 27})); 28