Allow flapping plugin to retry indefinitely

I've added some test for the existing code (not 100% coverage but better than nothing) and I've changed the max_retry option so that if we set it to -1, it retries indefinitely.

To test for restart, I wasn't able to mock the start call within the callback (looks like an interaction between mock and threading that I don't understand), so I've mocked the timer.