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 <fedor.indutny@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Trott authored and rvagg committed Jun 2, 2016
1 parent 0ae512a commit 1965e44
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 1965e44

Please sign in to comment.