Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2010-11-30 04:36:59 +0300
committerRyan Dahl <ry@tinyclouds.org>2010-11-30 04:36:59 +0300
commit1dbbaa7fa09e3bff48c5d7d9f6baf47fee49cc7b (patch)
tree1f090b98c03af39429ef48ea7c1633ec3d094049 /test
parent144b2a5338e681965be2d39a0514abc3864a1046 (diff)
Add test to show ECONNREFUSED works
Diffstat (limited to 'test')
-rw-r--r--test/simple/test-net-connect-handle-econnrefused.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/simple/test-net-connect-handle-econnrefused.js b/test/simple/test-net-connect-handle-econnrefused.js
new file mode 100644
index 00000000000..e311e137567
--- /dev/null
+++ b/test/simple/test-net-connect-handle-econnrefused.js
@@ -0,0 +1,24 @@
+var common = require('../common');
+var net = require('net');
+var assert = require('assert');
+
+
+// Hopefully nothing is running on common.PORT
+var c = net.createConnection(common.PORT);
+
+c.on('connect', function () {
+ console.error("connected?!");
+ assert.ok(false);
+})
+
+var gotError = false;
+c.on('error', function (e) {
+ console.error("couldn't connect.");
+ gotError = true;
+ assert.equal(require('constants').ECONNREFUSED, e.errno);
+});
+
+
+process.on('exit', function () {
+ assert.ok(gotError);
+});