Skip to content

Commit

Permalink
Lets see
Browse files Browse the repository at this point in the history
  • Loading branch information
santigimeno committed Jul 30, 2016
1 parent f789eb3 commit 3df3f47
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions test/parallel/test-tls-wrap-timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,29 @@ var options = {
cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
};

var server = tls.createServer(options, function(c) {
setTimeout(function() {
c.write('hello');
setTimeout(function() {
c.destroy();
server.close();
}, 150);
}, 150);
});

server.listen(0, function() {
var socket = net.connect(this.address().port, function() {
var s = socket.setTimeout(common.platformTimeout(240), function() {
throw new Error('timeout');
});
assert.ok(s instanceof net.Socket);
var server = tls.createServer(options, common.mustCall((c) => {
console.log('Server connected');
}));

server.listen(0, common.mustCall(() => {
var socket = net.connect(server.address().port, function() {
console.log('Client connected');
var tsocket = tls.connect({
socket: socket,
rejectUnauthorized: false
});
tsocket.resume();
setTimeout(common.mustCall(() => {
tsocket.write('hello');
setTimeout(common.mustCall(() => {
tsocket.destroy();
server.close();
}), common.platformTimeout(150));
}), common.platformTimeout(150));

var s = socket.setTimeout(common.platformTimeout(240), function() {
throw new Error('timeout');
});
assert.ok(s instanceof net.Socket);
});
});
}));

0 comments on commit 3df3f47

Please sign in to comment.