def test_tooManyAttempts(self):
        """
        Test that the server disconnects if the client fails authentication
        too many times.
        """
        packet = b''.join([NS(b'foo'), NS(b'none'), NS(b'password'), chr(0),
                           NS(b'bar')])
        self.authServer.clock = task.Clock()
        for i in range(21):
            d = self.authServer.ssh_USERAUTH_REQUEST(packet)
            self.authServer.clock.advance(2)
        def check(ignored):
            self.assertEqual(self.authServer.transport.packets[-1],
                (transport.MSG_DISCONNECT,
                b'\x00' * 3 +
                chr(transport.DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE) +
                NS(b"too many bad auths") + NS(b'')))
        return d.addCallback(check)

        Test that the server disconnects if the client fails authentication
        too many times.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/test/test_userauth.py