mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
42bce05ef6
PR-URL: https://github.com/nodejs/node/pull/53475 Reviewed-By: Tim Perry <pimterry@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
25 lines
657 B
JavaScript
25 lines
657 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
const assert = require('assert');
|
|
const http2 = require('http2');
|
|
const util = require('util');
|
|
|
|
const server = http2.createServer();
|
|
|
|
server.listen(0, common.mustCall(() => {
|
|
const port = server.address().port;
|
|
server.close(() => {
|
|
const connect = util.promisify(http2.connect);
|
|
connect(`http://localhost:${port}`)
|
|
.then(common.mustNotCall('Promise should not be resolved'))
|
|
.catch(common.mustCall((err) => {
|
|
assert(err instanceof Error);
|
|
assert.strictEqual(err.code, 'ECONNREFUSED');
|
|
}));
|
|
});
|
|
}));
|