mirror of
https://github.com/nodejs/node.git
synced 2024-11-30 23:43:09 +01:00
f29762f4dd
Enable linting for the test directory. A number of changes was made so all tests conform the current rules used by lib and src directories. The only exception for tests is that unreachable (dead) code is allowed. test-fs-non-number-arguments-throw had to be excluded from the changes because of a weird issue on Windows CI. PR-URL: https://github.com/nodejs/io.js/pull/1721 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
45 lines
868 B
JavaScript
45 lines
868 B
JavaScript
'use strict';
|
|
var net = require('net');
|
|
var common = require('../common');
|
|
var assert = require('assert');
|
|
|
|
var timeoutCount = 0;
|
|
|
|
var server = net.createServer(function(stream) {
|
|
stream.setTimeout(100);
|
|
|
|
stream.resume();
|
|
|
|
stream.on('timeout', function() {
|
|
console.log('timeout');
|
|
// try to reset the timeout.
|
|
stream.write('WHAT.');
|
|
// don't worry, the socket didn't *really* time out, we're just thinking
|
|
// it did.
|
|
timeoutCount += 1;
|
|
});
|
|
|
|
stream.on('end', function() {
|
|
console.log('server side end');
|
|
stream.end();
|
|
});
|
|
});
|
|
|
|
server.listen(common.PORT, function() {
|
|
var c = net.createConnection(common.PORT);
|
|
|
|
c.on('data', function() {
|
|
c.end();
|
|
});
|
|
|
|
c.on('end', function() {
|
|
console.log('client side end');
|
|
server.close();
|
|
});
|
|
});
|
|
|
|
|
|
process.on('exit', function() {
|
|
assert.equal(1, timeoutCount);
|
|
});
|