Handle InvalidEndpoint (network error) gracefully

Change-Id: I3f73c53e1400c862d8a2e468802662e7c619edc4