Modified ping server to stop the connection in the case that the ping fails due to a 401 or a 403 response.

#2488