Since okhttp 2.5.0, if there is no Internet connection, then the control will fall into the onFailure () function of the okhttp callback class. There you can check the reason for the exception and do what you need. PS uses the enqueue method to execute the request.
source
share