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(); 9 10// We use the lower-level API here 11server.on('stream', common.mustCall((stream) => { 12 stream.respond(); 13 stream.end('ok'); 14})); 15 16server.listen(0, common.mustCall(() => { 17 const client = h2.connect(`http://localhost:${server.address().port}`); 18 const req = client.request(); 19 req.priority({}); 20 21 req.on('response', common.mustCall()); 22 req.resume(); 23 req.on('end', common.mustCall()); 24 req.on('close', common.mustCall(() => { 25 server.close(); 26 client.close(); 27 })); 28})); 29