Handle error 502 from haproxy

If haproxy has successfully sent the request to API server, but API server dies before sending any response, haproxy sends error 502 to the caller. Added retry to handle this case.

Change-Id: I19aa17c0e337906e3c643fdff99da1b39a617686
Closes-Bug: 1396440
Merge "Handle error 502 from haproxy"