2014-02-18 09:30:12 +08:00
|
|
|
var common = require('../common');
|
|
|
|
var assert = require('assert');
|
|
|
|
var net = require('net');
|
|
|
|
|
2015-02-24 00:23:53 +08:00
|
|
|
connect({
|
|
|
|
host: 'localhost',
|
|
|
|
port: common.PORT,
|
|
|
|
localPort: 'foobar',
|
|
|
|
}, 'localPort should be a number: foobar');
|
2014-02-18 09:30:12 +08:00
|
|
|
|
2015-02-24 00:23:53 +08:00
|
|
|
connect({
|
|
|
|
host: 'localhost',
|
|
|
|
port: common.PORT,
|
|
|
|
localAddress: 'foobar',
|
|
|
|
}, 'localAddress should be a valid IP: foobar');
|
2014-02-18 09:30:12 +08:00
|
|
|
|
2015-01-04 07:26:26 +08:00
|
|
|
function connect(opts, msg) {
|
|
|
|
assert.throws(function() {
|
|
|
|
var client = net.connect(opts);
|
|
|
|
}, msg);
|
2014-02-18 09:30:12 +08:00
|
|
|
}
|