mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
This helps to prevent issues where a failed test can keep a bound socket open long enough to cause other tests to fail with EADDRINUSE because the same port number is used. PR-URL: https://github.com/nodejs/node/pull/7045 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rod Vagg <rod@vagg.org>
29 lines
694 B
JavaScript
29 lines
694 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const https = require('https');
|
|
|
|
if (!common.hasIPv6) {
|
|
common.skip('no IPv6 support');
|
|
return;
|
|
}
|
|
|
|
const ciphers = 'AECDH-NULL-SHA';
|
|
https.createServer({ ciphers }, function(req, res) {
|
|
this.close();
|
|
res.end();
|
|
}).listen(0, '::1', function() {
|
|
const options = {
|
|
host: 'localhost',
|
|
port: this.address().port,
|
|
family: 6,
|
|
ciphers: ciphers,
|
|
rejectUnauthorized: false,
|
|
};
|
|
// Will fail with ECONNREFUSED if the address family is not honored.
|
|
https.get(options, common.mustCall(function() {
|
|
assert.strictEqual('::1', this.socket.remoteAddress);
|
|
this.destroy();
|
|
}));
|
|
});
|