1'use strict'; 2 3const common = require('../common'); 4if (!common.hasCrypto) 5 common.skip('missing crypto'); 6const http2 = require('http2'); 7 8const server = http2.createServer(); 9server.setTimeout(common.platformTimeout(50)); 10 11const onServerTimeout = common.mustCall((session) => { 12 session.close(); 13}); 14 15server.on('stream', common.mustNotCall()); 16server.once('timeout', onServerTimeout); 17 18server.listen(0, common.mustCall(() => { 19 const url = `http://localhost:${server.address().port}`; 20 const client = http2.connect(url); 21 client.on('close', common.mustCall(() => { 22 const client2 = http2.connect(url); 23 client2.on('close', common.mustCall(() => server.close())); 24 })); 25})); 26