@Test public void backoff_withNoConnectionError_shouldUpdateBackoffTime() throws Exception { VolleyError volleyError = new NoConnectionError(); assertThat(subject.getBackoffMs()).isEqualTo(0); assertThat(subject.getRetryCount()).isEqualTo(0); subject.backoff(volleyError); assertThat(subject.getBackoffMs()).isEqualTo(60000); assertThat(subject.getRetryCount()).isEqualTo(1); }
@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);  }