diff --git a/test/parallel/test-tls-alert-handling.js b/test/parallel/test-tls-alert-handling.js index 79d2006d6bd261..63b845122fc1f0 100644 --- a/test/parallel/test-tls-alert-handling.js +++ b/test/parallel/test-tls-alert-handling.js @@ -48,6 +48,9 @@ server.listen(0, common.mustCall(function() { sendClient(); })); +server.on('tlsClientError', common.mustNotCall()); + +server.on('error', common.mustNotCall()); function sendClient() { const client = tls.connect(server.address().port, { @@ -78,8 +81,10 @@ function sendBADTLSRecord() { socket: socket, rejectUnauthorized: false }, common.mustCall(function() { - socket.write(BAD_RECORD); - socket.end(); + client.write('x'); + client.on('data', (data) => { + socket.end(BAD_RECORD); + }); })); client.on('error', common.mustCall((err) => { assert.strictEqual(err.code, 'ERR_SSL_TLSV1_ALERT_PROTOCOL_VERSION');