1'use strict'; 2 3const common = require('../common'); 4const { addresses } = require('../common/internet'); 5const assert = require('assert'); 6const dgram = require('dgram'); 7 8const client = dgram.createSocket('udp4'); 9client.connect(common.PORT, addresses.INVALID_HOST, common.mustCall((err) => { 10 assert.ok(err.code === 'ENOTFOUND' || err.code === 'EAI_AGAIN'); 11 12 client.once('error', common.mustCall((err) => { 13 assert.ok(err.code === 'ENOTFOUND' || err.code === 'EAI_AGAIN'); 14 client.once('connect', common.mustCall(() => client.close())); 15 client.connect(common.PORT); 16 })); 17 18 client.connect(common.PORT, addresses.INVALID_HOST); 19})); 20