[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Class MockHttpUnsuccessfulResponseHandler (2.0.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.0.0 (latest)](/java/docs/reference/google-http-client/latest/com.google.api.client.testing.http.MockHttpUnsuccessfulResponseHandler)\n- [1.47.1](/java/docs/reference/google-http-client/1.47.1/com.google.api.client.testing.http.MockHttpUnsuccessfulResponseHandler)\n- [1.46.3](/java/docs/reference/google-http-client/1.46.3/com.google.api.client.testing.http.MockHttpUnsuccessfulResponseHandler)\n- [1.45.3](/java/docs/reference/google-http-client/1.45.3/com.google.api.client.testing.http.MockHttpUnsuccessfulResponseHandler)\n- [1.44.2](/java/docs/reference/google-http-client/1.44.2/com.google.api.client.testing.http.MockHttpUnsuccessfulResponseHandler)\n- [1.43.2](/java/docs/reference/google-http-client/1.43.2/com.google.api.client.testing.http.MockHttpUnsuccessfulResponseHandler)\n- [1.42.3](/java/docs/reference/google-http-client/1.42.3/com.google.api.client.testing.http.MockHttpUnsuccessfulResponseHandler)\n- [1.41.8](/java/docs/reference/google-http-client/1.41.8/com.google.api.client.testing.http.MockHttpUnsuccessfulResponseHandler) \n\n public class MockHttpUnsuccessfulResponseHandler implements HttpUnsuccessfulResponseHandler\n\n[Beta](/java/docs/reference/google-http-client/latest/com.google.api.client.util.Beta) \n\nMock for [HttpUnsuccessfulResponseHandler](/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpUnsuccessfulResponseHandler).\n\nContains an [#isCalled](/java/docs/reference/google-http-client/latest/com.google.api.client.testing.http.MockHttpUnsuccessfulResponseHandler#com_google_api_client_testing_http_MockHttpUnsuccessfulResponseHandler_isCalled_) method that returns true if [#handleResponse](/java/docs/reference/google-http-client/latest/com.google.api.client.testing.http.MockHttpUnsuccessfulResponseHandler#com_google_api_client_testing_http_MockHttpUnsuccessfulResponseHandler_handleResponse_) is called. \n\nInheritance\n-----------\n\n[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \\\u003e MockHttpUnsuccessfulResponseHandler \n\nImplements\n----------\n\n[HttpUnsuccessfulResponseHandler](/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpUnsuccessfulResponseHandler) \n\nInherited Members\n-----------------\n\n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)\n\nConstructors\n------------\n\n### MockHttpUnsuccessfulResponseHandler(boolean successfullyHandleResponse)\n\n public MockHttpUnsuccessfulResponseHandler(boolean successfullyHandleResponse)\n\nCreate an instance of `MockHttpUnsuccessfulResponseHandler`.\n\nMethods\n-------\n\n### handleResponse(HttpRequest request, HttpResponse response, boolean supportsRetry)\n\n public boolean handleResponse(HttpRequest request, HttpResponse response, boolean supportsRetry)\n\nHandler that will be invoked when an abnormal response is received. There are a few simple\nrules that one must follow:\n\n- If you modify the request object or modify its execute interceptors in a way that should resolve the error, you must return true to issue a retry.\n- Do not read from the content stream, this will prevent the eventual end user from having access to it.\n\n### isCalled()\n\n public boolean isCalled()\n\nReturns whether the [#handleResponse](/java/docs/reference/google-http-client/latest/com.google.api.client.testing.http.MockHttpUnsuccessfulResponseHandler#com_google_api_client_testing_http_MockHttpUnsuccessfulResponseHandler_handleResponse_) method was called or not."]]