mirror of
https://github.com/nodejs/node.git
synced 2024-11-25 08:19:38 +01:00
3e1b1dd4a9
The copyright and license notice is already in the LICENSE file. There is no justifiable reason to also require that it be included in every file, since the individual files are not individually distributed except as part of the entire package.
42 lines
922 B
JavaScript
42 lines
922 B
JavaScript
var common = require('../common');
|
|
var assert = require('assert');
|
|
var net = require('net');
|
|
|
|
var serverGotEnd = false;
|
|
var clientGotEnd = false;
|
|
|
|
var server = net.createServer({allowHalfOpen: true}, function(socket) {
|
|
socket.resume();
|
|
socket.on('end', function() {
|
|
serverGotEnd = true;
|
|
});
|
|
socket.end();
|
|
});
|
|
|
|
server.listen(common.PORT, function() {
|
|
var client = net.connect({
|
|
host: '127.0.0.1',
|
|
port: common.PORT,
|
|
allowHalfOpen: true
|
|
}, function() {
|
|
console.error('client connect cb');
|
|
client.resume();
|
|
client.on('end', function() {
|
|
clientGotEnd = true;
|
|
setTimeout(function() {
|
|
assert(client.writable);
|
|
client.end();
|
|
}, 10);
|
|
});
|
|
client.on('close', function() {
|
|
server.close();
|
|
});
|
|
});
|
|
});
|
|
|
|
process.on('exit', function() {
|
|
console.error('exit', serverGotEnd, clientGotEnd);
|
|
assert(serverGotEnd);
|
|
assert(clientGotEnd);
|
|
});
|