@Test(expected = NoConnectionError.class) public void backoff_withNoAttemptsRemaining_shouldRethrowVolleyException() throws Exception { VolleyError volleyError = new NoConnectionError(); try { subject.backoff(volleyError); subject.backoff(volleyError); subject.backoff(volleyError); subject.backoff(volleyError); subject.backoff(volleyError); } catch (Exception e) { fail("Exception should not be thrown from above backoffs."); } subject.backoff(volleyError); }
@Override public void backoff(VolleyError volleyError) throws VolleyError { if (!hasAttemptRemaining()) { throw volleyError; } if (volleyError instanceof NoConnectionError) { updateBackoffTime(); return; } NetworkResponse networkResponse = volleyError.networkResponse; if (networkResponse != null && (networkResponse.statusCode == 503 || networkResponse.statusCode == 504)) { updateBackoffTime(); return; } throw volleyError; }
ScribeBackoffPolicy extends BackoffPolicy { @Override public void backoff(VolleyError volleyError) throws VolleyError { if (!hasAttemptRemaining()) { throw volleyError; } if (volleyError instanceof NoConnectionError) { updateBackoffTime(); return; } NetworkResponse networkResponse = volleyError.networkResponse; if (networkResponse != null && (networkResponse.statusCode == 503 || networkResponse.statusCode == 504)) { updateBackoffTime(); return; } throw volleyError; } }
ScribeBackoffPolicy extends BackoffPolicy { @Override public void backoff(VolleyError volleyError) throws VolleyError { if (!hasAttemptRemaining()) { throw volleyError; } if (volleyError instanceof NoConnectionError) { updateBackoffTime(); return; } NetworkResponse networkResponse = volleyError.networkResponse; if (networkResponse != null && (networkResponse.statusCode == 503 || networkResponse.statusCode == 504)) { updateBackoffTime(); return; } throw volleyError; } ScribeBackoffPolicy(); @VisibleForTesting  ScribeBackoffPolicy(int defaultBackoffTimeMs, int maxRetries, int backoffMultiplier); }
ScribeBackoffPolicy extends BackoffPolicy { @Override public void backoff(VolleyError volleyError) throws VolleyError { if (!hasAttemptRemaining()) { throw volleyError; } if (volleyError instanceof NoConnectionError) { updateBackoffTime(); return; } NetworkResponse networkResponse = volleyError.networkResponse; if (networkResponse != null && (networkResponse.statusCode == 503 || networkResponse.statusCode == 504)) { updateBackoffTime(); return; } throw volleyError; } ScribeBackoffPolicy(); @VisibleForTesting  ScribeBackoffPolicy(int defaultBackoffTimeMs, int maxRetries, int backoffMultiplier); @Override void backoff(VolleyError volleyError); }
ScribeBackoffPolicy extends BackoffPolicy { @Override public void backoff(VolleyError volleyError) throws VolleyError { if (!hasAttemptRemaining()) { throw volleyError; } if (volleyError instanceof NoConnectionError) { updateBackoffTime(); return; } NetworkResponse networkResponse = volleyError.networkResponse; if (networkResponse != null && (networkResponse.statusCode == 503 || networkResponse.statusCode == 504)) { updateBackoffTime(); return; } throw volleyError; } ScribeBackoffPolicy(); @VisibleForTesting  ScribeBackoffPolicy(int defaultBackoffTimeMs, int maxRetries, int backoffMultiplier); @Override void backoff(VolleyError volleyError);  }