@Test
public void noConnection() throws Exception {

    MockHttpStack mockHttpStack = new MockHttpStack();
    mockHttpStack.setExceptionToThrow(new IOException());
    BasicNetwork httpNetwork = new BasicNetwork(mockHttpStack);
    Request<String> request = buildRequest();
    request.setRetryPolicy(mMockRetryPolicy);
    doThrow(new VolleyError()).when(mMockRetryPolicy).retry(any(VolleyError.class));
    try {
        httpNetwork.performRequest(request);
    } catch (VolleyError e) {
        // expected
    }
    // should not retry when there is no connection
    verify(mMockRetryPolicy, never()).retry(any(VolleyError.class));
}