0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 07:53:06 +01:00
nodejs/test/pummel/test-http-client-reconnect-bug.js

28 lines
663 B
JavaScript
Raw Normal View History

'use strict';
const common = require('../common');
const net = require('net');
const http = require('http');
2010-08-11 02:37:30 +02:00
var server = net.createServer(function(socket) {
socket.end();
});
server.on('listening', common.mustCall(function() {
2010-08-11 02:37:30 +02:00
var client = http.createClient(common.PORT);
client.on('error', common.mustCall(function(err) {}));
client.on('end', common.mustCall(function() {}));
2010-08-11 02:37:30 +02:00
2010-12-03 02:03:18 +01:00
var request = client.request('GET', '/', {'host': 'localhost'});
2010-08-11 02:37:30 +02:00
request.end();
request.on('response', function(response) {
2010-12-03 02:03:18 +01:00
console.log('STATUS: ' + response.statusCode);
2010-08-11 02:37:30 +02:00
});
}));
2010-08-11 02:37:30 +02:00
server.listen(common.PORT);
2010-12-03 02:03:18 +01:00
setTimeout(function() {
server.close();
}, 500);