diff --git a/test/parallel/test-tls-alert-handling.js b/test/parallel/test-tls-alert-handling.js index c686d68a182e3d..e88453b115e0ea 100644 --- a/test/parallel/test-tls-alert-handling.js +++ b/test/parallel/test-tls-alert-handling.js @@ -43,6 +43,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, { @@ -73,8 +76,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()); }