1'use strict'; 2 3const common = require('../common'); 4if (!common.hasCrypto) 5 common.skip('missing crypto'); 6const h2 = require('http2'); 7 8const server = h2.createServer(); 9server.listen(0, common.localhostIPv4, common.mustCall(() => { 10 const afterConnect = common.mustCall((session) => { 11 session.request({ ':method': 'POST' }).end(common.mustCall(() => { 12 session.destroy(); 13 server.close(); 14 })); 15 }); 16 17 const port = server.address().port; 18 const host = common.localhostIPv4; 19 h2.connect(`http://${host}:${port}`, afterConnect); 20})); 21