mirror of
https://github.com/nodejs/node.git
synced 2025-05-05 19:08:17 +00:00

This helps to prevent issues where a failed test can keep a bound socket open long enough to cause other tests to fail with EADDRINUSE because the same port number is used. PR-URL: https://github.com/nodejs/node/pull/7045 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rod Vagg <rod@vagg.org>
20 lines
574 B
JavaScript
20 lines
574 B
JavaScript
'use strict';
|
|
require('../common');
|
|
var net = require('net');
|
|
var http = require('http');
|
|
|
|
// This is a regression test for https://github.com/joyent/node/issues/44
|
|
// It is separate from test-http-malformed-request.js because it is only
|
|
// reproduceable on the first packet on the first connection to a server.
|
|
|
|
var server = http.createServer(function(req, res) {});
|
|
server.listen(0);
|
|
|
|
server.on('listening', function() {
|
|
net.createConnection(this.address().port).on('connect', function() {
|
|
this.destroy();
|
|
}).on('close', function() {
|
|
server.close();
|
|
});
|
|
});
|