Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: use common.mustCall in test-tls-connect-given-socket.js #12592

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
test: replaces process exit with mustCall
  • Loading branch information
vperezma committed Apr 22, 2017
commit 70aea60155046d359931f34b7cb168ae82e940cd
9 changes: 3 additions & 6 deletions test/parallel/test-tls-connect-given-socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,16 @@ const net = require('net');
const fs = require('fs');
const path = require('path');

let serverConnected = 0;
let clientConnected = 0;

const options = {
key: fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem')),
cert: fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem'))
};

const server = tls.createServer(options, (socket) => {
serverConnected++;
const server = tls.createServer(options, common.mustCall((socket) => {
socket.end('Hello');
}).listen(0, () => {
}, 2)).listen(0, common.mustCall(() => {
let waiting = 2;
function establish(socket) {
const client = tls.connect({
Expand Down Expand Up @@ -91,9 +89,8 @@ const server = tls.createServer(options, (socket) => {
const connecting = net.connect(port);
establish(connecting);
}
});
}));

process.on('exit', () => {
assert.strictEqual(serverConnected, 2);
assert.strictEqual(clientConnected, 2);
});