mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +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.
28 lines
598 B
JavaScript
28 lines
598 B
JavaScript
var common = require('../common');
|
|
var assert = require('assert');
|
|
var net = require('net');
|
|
|
|
var received = '';
|
|
|
|
var server = net.createServer(function(socket) {
|
|
socket.pipe(socket);
|
|
}).listen(common.PORT, function() {
|
|
var conn = net.connect(common.PORT);
|
|
conn.setEncoding('utf8');
|
|
conn.write('before');
|
|
conn.on('connect', function() {
|
|
conn.write('after');
|
|
});
|
|
conn.on('data', function(buf) {
|
|
received += buf;
|
|
conn.end();
|
|
});
|
|
conn.on('end', function() {
|
|
server.close();
|
|
});
|
|
});
|
|
|
|
process.on('exit', function() {
|
|
assert.equal(received, 'before' + 'after');
|
|
});
|