diff --git a/test/fixtures/child.js b/test/fixtures/child.js index 0dc42cb1..5cdc2c4b 100644 --- a/test/fixtures/child.js +++ b/test/fixtures/child.js @@ -1,14 +1,10 @@ var http = require('http'); -var app = http.createServer(function(req, res) { +http.createServer(function(req, res) { res.writeHead(200); res.end('hey'); -}) - -var listener = app.listen(0, function() { - console.log('Listening on port ' + listener.address().port); -}); +}).listen(0); process.on('message', function(msg) { if (msg == 'shutdown') { diff --git a/test/fixtures/http.js b/test/fixtures/http.js new file mode 100644 index 00000000..0dc42cb1 --- /dev/null +++ b/test/fixtures/http.js @@ -0,0 +1,21 @@ + +var http = require('http'); + +var app = http.createServer(function(req, res) { + res.writeHead(200); + res.end('hey'); +}) + +var listener = app.listen(0, function() { + console.log('Listening on port ' + listener.address().port); +}); + +process.on('message', function(msg) { + if (msg == 'shutdown') { + console.log('Closing all connections...'); + setTimeout(function() { + console.log('Finished closing connections'); + process.exit(0); + }, 100); + } +});