I am working with a web service that returns 401 when my cookie expires, which results in an HttpUrlConnection error:
java.io.IOException: No authentication challenges found at libcore.net.http.HttpURLConnectionImpl.getAuthorizationCredentials(HttpURLConnectionImpl.java:427) at libcore.net.http.HttpURLConnectionImpl.processAuthHeader(HttpURLConnectionImpl.java:407) at libcore.net.http.HttpURLConnectionImpl.processResponseHeaders(HttpURLConnectionImpl.java:356) at ...
I know this happens because the server does not return the WWW-Authenticate header, but it is out of my control. It's nice that the HttpUrlConnection does this for me, but it is a real world, and we do not always work with servers that perfectly follow the HTTP specification. I cannot move away from HttpUrlConnection due to other code dependencies, so how do I disable validation so that I can really use the answer?
source share