-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: refactor test-tls-timeout-server-2
* Use `common.mustCall` for all callbacks * Use `const` instead of `var` PR-URL: #9876 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
- Loading branch information
1 parent
aaab510
commit 998db3a
Showing
1 changed file
with
10 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
'use strict'; | ||
var common = require('../common'); | ||
var assert = require('assert'); | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
|
||
if (!common.hasCrypto) { | ||
common.skip('missing crypto'); | ||
return; | ||
} | ||
var tls = require('tls'); | ||
const tls = require('tls'); | ||
|
||
var fs = require('fs'); | ||
const fs = require('fs'); | ||
|
||
var options = { | ||
const options = { | ||
key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'), | ||
cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem') | ||
}; | ||
|
||
var server = tls.createServer(options, function(cleartext) { | ||
var s = cleartext.setTimeout(50, function() { | ||
const server = tls.createServer(options, common.mustCall(function(cleartext) { | ||
const s = cleartext.setTimeout(50, function() { | ||
cleartext.destroy(); | ||
server.close(); | ||
}); | ||
assert.ok(s instanceof tls.TLSSocket); | ||
}); | ||
})); | ||
|
||
server.listen(0, function() { | ||
server.listen(0, common.mustCall(function() { | ||
tls.connect({ | ||
host: '127.0.0.1', | ||
port: this.address().port, | ||
rejectUnauthorized: false | ||
}); | ||
}); | ||
})); |