Instead of throwing an IOException with String message, use the new
HttpException. The exception handling code can then use the status
code to be more specific how to handle the exception.
Also: use try-with-resources for the okhttp response where possible
All the HTTP clients now check, if loading the cookies was sufficient
to restore the HTTP session. If yes, we assume that we are logged in.
If not, the normal login procedure is done.