mirror of
https://github.com/nodejs/node.git
synced 2024-11-30 15:30:56 +01:00
7294897c77
This test is not parallelized and so we can use the test commons PORT variable. Refs: https://github.com/nodejs/node/pull/27565#discussion_r281000162 PR-URL: https://github.com/nodejs/node/pull/27565 Fixes: https://github.com/nodejs/node/issues/27341 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
20 lines
649 B
JavaScript
20 lines
649 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const { addresses } = require('../common/internet');
|
|
const assert = require('assert');
|
|
const dgram = require('dgram');
|
|
|
|
const client = dgram.createSocket('udp4');
|
|
client.connect(common.PORT, addresses.INVALID_HOST, common.mustCall((err) => {
|
|
assert.ok(err.code === 'ENOTFOUND' || err.code === 'EAI_AGAIN');
|
|
|
|
client.once('error', common.mustCall((err) => {
|
|
assert.ok(err.code === 'ENOTFOUND' || err.code === 'EAI_AGAIN');
|
|
client.once('connect', common.mustCall(() => client.close()));
|
|
client.connect(common.PORT);
|
|
}));
|
|
|
|
client.connect(common.PORT, addresses.INVALID_HOST);
|
|
}));
|