Skip to content

Commit

Permalink
TLS/SSL: Adds test case for tls not emiting error event on handshake …
Browse files Browse the repository at this point in the history
…failure

nodejs#8803
  • Loading branch information
lekoder committed Oct 7, 2016
1 parent b2534f1 commit 0875565
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/parallel/test-tls-failed-handshake-emits-error.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
'use strict';
var common = require('../common');

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

var bonkers = Buffer.alloc(1024, 42);

var server = net.createServer(common.mustCall(function(c) {
setTimeout(common.mustCall(function() {
var s = new tls.TLSSocket(c, {
isServer: true,
server: server
});

s.on('error', common.mustCall(function() {}));

s.on('close', function() {
server.close();
s.destroy();
});
}), 200);
})).listen(0, function() {
var c = net.connect({port: this.address().port}, function() {
c.write(bonkers);
});
});

0 comments on commit 0875565

Please sign in to comment.