diff options
author | Micheil Smith <micheil@brandedcode.com> | 2010-06-18 10:34:56 -0700 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2010-06-18 10:34:56 -0700 |
commit | e0d30b545a737c43097f96446d82374ab2fd1e9a (patch) | |
tree | bfe1c66bc6a1b66e001d6241c7efd4d26fb8b1e4 /test/simple/test-net-keepalive.js | |
parent | 3f48276bf9e36d6af5760aeb4fbd1123f6c4f207 (diff) | |
download | node-new-e0d30b545a737c43097f96446d82374ab2fd1e9a.tar.gz |
Renaming tcp tests to net tests
Diffstat (limited to 'test/simple/test-net-keepalive.js')
-rw-r--r-- | test/simple/test-net-keepalive.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/simple/test-net-keepalive.js b/test/simple/test-net-keepalive.js new file mode 100644 index 0000000000..adf532663e --- /dev/null +++ b/test/simple/test-net-keepalive.js @@ -0,0 +1,28 @@ +require("../common"); +net = require('net'); + +var serverConnection; +var echoServer = net.createServer(function (connection) { + serverConnection = connection; + connection.setTimeout(0); + assert.notEqual(connection.setKeepAlive,undefined); + // send a keepalive packet after 1000 ms + connection.setKeepAlive(true,1000); + connection.addListener("end", function () { + connection.end(); + }); +}); +echoServer.listen(PORT); + +var clientConnection = net.createConnection(PORT); +clientConnection.setTimeout(0); + +setTimeout( function() { + // make sure both connections are still open + assert.equal(serverConnection.readyState,"open"); + assert.equal(clientConnection.readyState,"open"); + serverConnection.end(); + clientConnection.end(); + echoServer.close(); +}, 1200); + |