Do we have any possibility to stop request in OkHttp Interceptor? : <p>In our app we met with one special case - if our <code>App.specialFlag == true</code>, we need stop any request from our code. And we think, that the best approach in this situation is include special <code>Interceptor</code> which will stop any our requests, something like this:</p>

<pre><code>if (App.specialFlag) {
    // Somehow stop request
} else {
    return chain.proceed(chain.request());
}
</code></pre>

<p>Also, we should note, that we use <code>RxJavaCallAdapterFactory</code> for wrapping responses into <code>Observable</code>s.</p>

<p>But we don't see any methods for stopping request in OkHttp Interceptors. </p>

<p>We came up with two ways to solve our issue:</p>

<p>a) Create special <code>ApiService.class</code> for wrapping every request in our API like this:</p>

<pre><code>public Observable&lt;User&gt; getUserDetails() {
    if (App.specialFlag) {
        return Observable.just(null);
    }
    return api.getUserDetails();
}
</code></pre>

<p>But we think that it is ugly and cumbersome solution.</p>

<p>b) Throw a <code>RuntimeException</code> in Interceptor, then catch it in every place we use our API. </p>

<p>The second solution is also not good, because we need to include a lot of <code>onErrorResumeNext</code> operators in our chains.</p>

<p>May be someone knows, how to handle our situation in more 'clever' way?..</p>

<p>Thanks in advance!</p>
