You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
745 B
33 lines
745 B
var harness = require('./harness'); |
|
|
|
// Test that connection handles an array of hostnames. |
|
// If given one, without an index (`this.hosti`), it will randomly pick one. |
|
options.host = [options.host,"nohost:5673"]; |
|
options.reconnect = true; |
|
|
|
|
|
for (var i = 0; i < options.host.length; i++){ |
|
test(); |
|
} |
|
|
|
function test() { |
|
var conn = harness.createConnection(); |
|
|
|
var callbackCalled = false; |
|
conn.once('ready', function() { |
|
callbackCalled = true; |
|
conn.destroy(); |
|
}); |
|
|
|
conn.once('close', function() { |
|
assert(callbackCalled); |
|
callbackCalled = false; |
|
}); |
|
|
|
conn.once('error', function(e) { |
|
// If we get an error, it should be ENOTFOUND (bad dns); |
|
assert(e.code === 'ENOTFOUND'); |
|
callbackCalled = true; |
|
}); |
|
} |
|
|
|
|