Skip to content

Commit

Permalink
test: refactor test-tls-reuse-host-from-socket
Browse files Browse the repository at this point in the history
Replace booleans with `common.mustCall()`, migrate from `var` to
`const`, and apply minor formatting changes.

PR-URL: #6756
Reviewed-By: Fedor Indutny <[email protected]>
Reviewed-By: Santiago Gimeno <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
Trott authored and Myles Borins committed Jun 24, 2016
1 parent 30ab6a8 commit 4e38655
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions test/internet/test-tls-reuse-host-from-socket.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
'use strict';
var common = require('../common');
var assert = require('assert');
const common = require('../common');

if (!common.hasCrypto) {
common.skip('missing crypto');
return;
}
var tls = require('tls');
const tls = require('tls');

var net = require('net');
var connected = false;
var secure = false;
const net = require('net');

process.on('exit', function() {
assert(connected);
assert(secure);
console.log('ok');
});

var socket = net.connect(443, 'www.google.com', function() {
connected = true;
var secureSocket = tls.connect({ socket: socket }, function() {
secure = true;
const socket = net.connect(443, 'www.example.org', common.mustCall(() => {
const secureSocket = tls.connect({socket: socket}, common.mustCall(() => {
secureSocket.destroy();
});
});
console.log('ok');
}));
}));

0 comments on commit 4e38655

Please sign in to comment.