diff --git a/src/transport/tests/listen-test.js b/src/transport/tests/listen-test.js index a45519519..8dc49302b 100644 --- a/src/transport/tests/listen-test.js +++ b/src/transport/tests/listen-test.js @@ -92,6 +92,20 @@ module.exports = (common) => { expect(upgradeSpy.callCount).to.equal(2) }) + it('should not handle connection if upgradeInbound throws', async () => { + sinon.stub(upgrader, 'upgradeInbound').throws() + + const listener = transport.createListener(() => { + throw new Error('should not handle the connection if upgradeInbound throws') + }) + + // Listen + await listener.listen(addrs[0]) + + // Create a connection to the listener + await transport.dial(addrs[0]) + }) + describe('events', () => { it('connection', (done) => { const upgradeSpy = sinon.spy(upgrader, 'upgradeInbound')