Retry if api returns http status code != 200

When server is busy, it returns http error code 500 and clients
are expected to retry.
Fix unit few tests