Added extra conditions to retry logic

Done. The BACKEND_REASON should cover the 503 case, but since I can test the status code without reading the inputstream I've change the test to ==503.