java.net.UnknownHostException cannot be cast to retrofit2.adapter.rxjava.HttpException with RxJava
<p>I am getting this error in my logs: </p>

<pre><code>Caused by java.lang.ClassCastException: java.net.UnknownHostException cannot be cast to retrofit2.adapter.rxjava.HttpException
</code></pre>

<p>and thats my onError method. The error is probably caused when the device has no connection.</p>

<pre><code>  @Override
        public void onError(Throwable e) {
            assert e != null;
            Timber.d(e);
            HttpException exception = (HttpException) e;
            assert view != null;
            view.hideRefreshSpinner();
            if (exception.code() == HttpURLConnection.HTTP_BAD_REQUEST) {
                view.showSnackbarInvalidError();
            } else {
                view.showUnauthorizedError();
            }

        }
</code></pre>