diff options
Diffstat (limited to 'test/parallel/test-https-client-reject.js')
-rw-r--r-- | test/parallel/test-https-client-reject.js | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/test/parallel/test-https-client-reject.js b/test/parallel/test-https-client-reject.js index 1bf42e5df5..b1708f24b1 100644 --- a/test/parallel/test-https-client-reject.js +++ b/test/parallel/test-https-client-reject.js @@ -16,14 +16,11 @@ var options = { cert: fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem')) }; -var reqCount = 0; - -var server = https.createServer(options, function(req, res) { - ++reqCount; +var server = https.createServer(options, common.mustCall(function(req, res) { res.writeHead(200); res.end(); req.resume(); -}).listen(0, function() { +}, 2)).listen(0, function() { unauthorized(); }); @@ -47,9 +44,7 @@ function rejectUnauthorized() { port: server.address().port }; options.agent = new https.Agent(options); - var req = https.request(options, function(res) { - assert(false); - }); + var req = https.request(options, common.fail); req.on('error', function(err) { authorized(); }); @@ -67,12 +62,6 @@ function authorized() { assert(req.socket.authorized); server.close(); }); - req.on('error', function(err) { - assert(false); - }); + req.on('error', common.fail); req.end(); } - -process.on('exit', function() { - assert.equal(reqCount, 2); -}); |