Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions test/parallel/test-net-keepalive.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,17 @@ var assert = require('assert');
var net = require('net');

var serverConnection;
var clientConnection;
var echoServer = net.createServer(function(connection) {
serverConnection = connection;
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();
}, common.platformTimeout(100));
connection.setTimeout(0);
assert.notEqual(connection.setKeepAlive, undefined);
// send a keepalive packet after 50 ms
Expand All @@ -17,15 +26,6 @@ var echoServer = net.createServer(function(connection) {
echoServer.listen(common.PORT);

echoServer.on('listening', function() {
var clientConnection = net.createConnection(common.PORT);
clientConnection = net.createConnection(common.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();
}, common.platformTimeout(100));
});