I'm changing it in a a way that it will try NUM_RETRIES times to get the expected response, every try waiting for a response BREAK_TIMEOUT seconds.

If you see a better approach, feedback is more than welcome! :)