@Beta public class MockHttpUnsuccessfulResponseHandler extends Object implements HttpUnsuccessfulResponseHandler
Beta
HttpUnsuccessfulResponseHandler
.
Contains an isCalled
method that returns true if handleResponse(com.google.api.client.http.HttpRequest, com.google.api.client.http.HttpResponse, boolean)
is called.
Constructor and Description |
---|
MockHttpUnsuccessfulResponseHandler(boolean successfullyHandleResponse)
Create an instance of
MockHttpUnsuccessfulResponseHandler . |
Modifier and Type | Method and Description |
---|---|
boolean |
handleResponse(HttpRequest request,
HttpResponse response,
boolean supportsRetry)
Handler that will be invoked when an abnormal response is received.
|
boolean |
isCalled()
Returns whether the
handleResponse(com.google.api.client.http.HttpRequest, com.google.api.client.http.HttpResponse, boolean) method was called or not. |
public MockHttpUnsuccessfulResponseHandler(boolean successfullyHandleResponse)
MockHttpUnsuccessfulResponseHandler
.successfullyHandleResponse
- This will be the return value of handleResponse(com.google.api.client.http.HttpRequest, com.google.api.client.http.HttpResponse, boolean)
public boolean isCalled()
handleResponse(com.google.api.client.http.HttpRequest, com.google.api.client.http.HttpResponse, boolean)
method was called or not.public boolean handleResponse(HttpRequest request, HttpResponse response, boolean supportsRetry) throws IOException
HttpUnsuccessfulResponseHandler
handleResponse
in interface HttpUnsuccessfulResponseHandler
request
- Request object that can be read from for context or modified before retryresponse
- Response to processsupportsRetry
- Whether there will actually be a retry if this handler return true
. Some handlers may want to have an effect only when there will actually be a retry
after they handle their event (e.g. a handler that implements exponential backoff).IOException
Copyright © 2011–2023 Google. All rights reserved.