summaryrefslogtreecommitdiff
path: root/test/parallel/test-net-better-error-messages-port-hostname.js
blob: 04974908c91e8704891dda5d79faea04afdd9ebc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
'use strict';
const common = require('../common');
const net = require('net');
const assert = require('assert');

// Using port 0 as hostname used is already invalid.
const c = net.createConnection(0, '***');

c.on('connect', common.mustNotCall());

c.on('error', common.mustCall(function(e) {
  assert.strictEqual(e.code, 'ENOTFOUND');
  assert.strictEqual(e.port, 0);
  assert.strictEqual(e.hostname, '***');
}));