반환 사실의 서브 클래스입니다 DefaultHttpRequestRetryHandler를 사용합니다.
예외가 throw되는 것을 방지해야합니다.
또한 처리기에서 시간 초과 예외도 처리 할 수 있습니다.
httpClient.setHttpRequestRetryHandler(new HttpRequestRetryHandler() {
@Override
public boolean retryRequest(final IOException ioe,
final int numRetry, final HttpContext context)
{
Log.d(TAG, "retry handler received exception of type: " + ioe.getClass().getName() + ", num retries: " + numRetry);
if (numRetry > 4) { // 3 retries
return false;
}
// Some exceptions we can retry without knowledge of which methods are being invoked
if (ioe instanceof NoHttpResponseException
|| ioe instanceof UnknownHostException
|| ioe instanceof SocketException
// Replace with the actual type of the exception
|| ioe instanceof TimeoutException) {
return true;
}
return false;
}
});
불행히도 프로젝트 소스 코드에 액세스 할 수 없어 더 이상 시험 할 수 없습니다. – skyler