node/test/parallel/test-net-localerror.js

22 lines
450 B
JavaScript

var common = require('../common');
var assert = require('assert');
var net = require('net');
connect({
host: 'localhost',
port: common.PORT,
localPort: 'foobar',
}, 'localPort should be a number: foobar');
connect({
host: 'localhost',
port: common.PORT,
localAddress: 'foobar',
}, 'localAddress should be a valid IP: foobar');
function connect(opts, msg) {
assert.throws(function() {
var client = net.connect(opts);
}, msg);
}