diff --git a/test/transports.websocket.test.js b/test/transports.websocket.test.js index 298c4b4cbc..97f871db4f 100644 --- a/test/transports.websocket.test.js +++ b/test/transports.websocket.test.js @@ -131,7 +131,7 @@ module.exports = { var url = '/socket.io/' + sio.protocol + '/websocket/' + sid; var req = cl.get(url, {headers: headers}, function (res, data) {}); var closed = false; - req.socket.on('close', function() { + (req.socket || req).on('close', function() { if (closed) return; closed = true; notConnected.should.be.true; @@ -169,7 +169,7 @@ module.exports = { var url = '/socket.io/' + sio.protocol + '/websocket/' + sid; var req = cl.get(url, {headers: headers}, function (res, data) {}); var closed = false; - req.socket.on('close', function() { + (req.socket || req).on('close', function() { if (closed) return; closed = true; notConnected.should.be.true;