node/test/parallel/test-tls-server-failed-handshake-emits-clienterror.js
Tobias Nießen bc58a854e2
test: remove OpenSSL 1.0.2 error message compat
While upgrading from OpenSSL 1.0.2 to 1.1.1, these tests were modified
to recognize error messages from both OpenSSL releases. Given that
OpenSSL 1.0.2 has been unsupported for years, it is safe to remove the
older message patterns.

Refs: https://github.com/nodejs/node/pull/16130
PR-URL: https://github.com/nodejs/node/pull/46709
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2023-02-22 06:09:11 +00:00

30 lines
725 B
JavaScript

'use strict';
const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
const tls = require('tls');
const net = require('net');
const assert = require('assert');
const bonkers = Buffer.alloc(1024, 42);
const server = tls.createServer({})
.listen(0, function() {
const c = net.connect({ port: this.address().port }, function() {
c.write(bonkers);
});
}).on('tlsClientError', common.mustCall(function(e) {
assert.ok(e instanceof Error,
'Instance of Error should be passed to error handler');
assert.ok(
/SSL routines:[^:]*:wrong version number/.test(
e.message),
'Expecting SSL unknown protocol');
server.close();
}));