diff --git a/test/parallel/test-http2-empty-frame-without-eof.js b/test/parallel/test-http2-empty-frame-without-eof.js index 2cd7d799769882..c384fdee6faf75 100644 --- a/test/parallel/test-http2-empty-frame-without-eof.js +++ b/test/parallel/test-http2-empty-frame-without-eof.js @@ -10,7 +10,9 @@ const { once } = require('events'); async function main() { const blobWithEmptyFrame = readSync('emptyframe.http2'); const server = net.createServer((socket) => { - socket.end(blobWithEmptyFrame); + socket.once('data', () => { + socket.end(blobWithEmptyFrame); + }); }).listen(0); await once(server, 'listening');