summaryrefslogtreecommitdiff
path: root/test/parallel/test-domain-multi.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/parallel/test-domain-multi.js')
-rw-r--r--test/parallel/test-domain-multi.js32
1 files changed, 16 insertions, 16 deletions
diff --git a/test/parallel/test-domain-multi.js b/test/parallel/test-domain-multi.js
index ac01d66dee..1b0af1dd3f 100644
--- a/test/parallel/test-domain-multi.js
+++ b/test/parallel/test-domain-multi.js
@@ -1,7 +1,7 @@
'use strict';
// Tests of multiple domains happening at once.
-var common = require('../common');
+require('../common');
var assert = require('assert');
var domain = require('domain');
@@ -49,24 +49,24 @@ var server = http.createServer(function(req, res) {
throw new Error('this kills domain B, not A');
}));
-}).listen(common.PORT);
+}).listen(0, function() {
+ var c = domain.create();
+ var req = http.get({ host: 'localhost', port: this.address().port });
-var c = domain.create();
-var req = http.get({ host: 'localhost', port: common.PORT });
+ // add the request to the C domain
+ c.add(req);
-// add the request to the C domain
-c.add(req);
-
-req.on('response', function(res) {
- console.error('got response');
- // add the response object to the C domain
- c.add(res);
- res.pipe(process.stdout);
-});
+ req.on('response', function(res) {
+ console.error('got response');
+ // add the response object to the C domain
+ c.add(res);
+ res.pipe(process.stdout);
+ });
-c.on('error', function(er) {
- caughtC = true;
- console.error('Error on c', er.message);
+ c.on('error', function(er) {
+ caughtC = true;
+ console.error('Error on c', er.message);
+ });
});
process.on('exit', function() {