1'use strict'; 2 3const common = require('../common'); 4if (!common.hasCrypto) 5 common.skip('missing crypto'); 6const h2 = require('http2'); 7const assert = require('assert'); 8 9 10const server = h2.createServer(common.mustCall(function(req, res) { 11 req.on('aborted', common.mustCall(function() { 12 assert.strictEqual(this.aborted, true); 13 assert.strictEqual(this.complete, true); 14 })); 15 assert.strictEqual(req.aborted, false); 16 assert.strictEqual(req.complete, false); 17 res.write('hello'); 18 server.close(); 19})); 20 21server.listen(0, common.mustCall(function() { 22 const url = `http://localhost:${server.address().port}`; 23 const client = h2.connect(url, common.mustCall(() => { 24 const request = client.request(); 25 request.on('data', common.mustCall((chunk) => { 26 client.destroy(); 27 })); 28 })); 29})); 30