summaryrefslogtreecommitdiff
path: root/test/parallel/test-tls-connect-no-host.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/parallel/test-tls-connect-no-host.js')
-rw-r--r--test/parallel/test-tls-connect-no-host.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/test/parallel/test-tls-connect-no-host.js b/test/parallel/test-tls-connect-no-host.js
index 86203d7f42..e2e0238ff8 100644
--- a/test/parallel/test-tls-connect-no-host.js
+++ b/test/parallel/test-tls-connect-no-host.js
@@ -20,16 +20,16 @@ var key = fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem'));
tls.createServer({
key: key,
cert: cert
-}).listen(common.PORT);
-
-var socket = tls.connect({
- port: common.PORT,
- ca: cert,
- // No host set here. 'localhost' is the default,
- // but tls.checkServerIdentity() breaks before the fix with:
- // Error: Hostname/IP doesn't match certificate's altnames:
- // "Host: undefined. is not cert's CN: localhost"
-}, function() {
- assert(socket.authorized);
- process.exit();
+}).listen(0, function() {
+ var socket = tls.connect({
+ port: this.address().port,
+ ca: cert,
+ // No host set here. 'localhost' is the default,
+ // but tls.checkServerIdentity() breaks before the fix with:
+ // Error: Hostname/IP doesn't match certificate's altnames:
+ // "Host: undefined. is not cert's CN: localhost"
+ }, function() {
+ assert(socket.authorized);
+ process.exit();
+ });
});