@Test public void onErrorResponse_withBackoffApplied_shouldCallBackoff_shouldMakeDelayedRequest() throws Exception { when(mockScribeBackoffPolicy.getRetryCount()).thenReturn(1); when(mockScribeBackoffPolicy.getBackoffMs()).thenReturn(100); VolleyError volleyError = new NoConnectionError(); subject.onErrorResponse(volleyError); verify(mockScribeBackoffPolicy).backoff(volleyError); verify(mockRequestQueue).addDelayedRequest(mockScribeRequest, 100); }
@Override public void onErrorResponse(final VolleyError volleyError) { mHandler.post(new Runnable() { @Override public void run() { try { mBackoffPolicy.backoff(volleyError); makeRequestInternal(); } catch (VolleyError e) { MoPubLog.d("Failed to Scribe events: " + volleyError); clearRequest(); } } }); }
ScribeRequestManager extends RequestManager<ScribeRequestFactory> implements ScribeRequest.Listener { @Override public void onErrorResponse(final VolleyError volleyError) { mHandler.post(new Runnable() { @Override public void run() { try { mBackoffPolicy.backoff(volleyError); makeRequestInternal(); } catch (VolleyError e) { MoPubLog.d("Failed to Scribe events: " + volleyError); clearRequest(); } } }); } }
ScribeRequestManager extends RequestManager<ScribeRequestFactory> implements ScribeRequest.Listener { @Override public void onErrorResponse(final VolleyError volleyError) { mHandler.post(new Runnable() { @Override public void run() { try { mBackoffPolicy.backoff(volleyError); makeRequestInternal(); } catch (VolleyError e) { MoPubLog.d("Failed to Scribe events: " + volleyError); clearRequest(); } } }); } ScribeRequestManager(final Looper looper); }
ScribeRequestManager extends RequestManager<ScribeRequestFactory> implements ScribeRequest.Listener { @Override public void onErrorResponse(final VolleyError volleyError) { mHandler.post(new Runnable() { @Override public void run() { try { mBackoffPolicy.backoff(volleyError); makeRequestInternal(); } catch (VolleyError e) { MoPubLog.d("Failed to Scribe events: " + volleyError); clearRequest(); } } }); } ScribeRequestManager(final Looper looper); @Override void onResponse(); @Override void onErrorResponse(final VolleyError volleyError); }
ScribeRequestManager extends RequestManager<ScribeRequestFactory> implements ScribeRequest.Listener { @Override public void onErrorResponse(final VolleyError volleyError) { mHandler.post(new Runnable() { @Override public void run() { try { mBackoffPolicy.backoff(volleyError); makeRequestInternal(); } catch (VolleyError e) { MoPubLog.d("Failed to Scribe events: " + volleyError); clearRequest(); } } }); } ScribeRequestManager(final Looper looper); @Override void onResponse(); @Override void onErrorResponse(final VolleyError volleyError);  }