私はこのオーセンティケータを持っています:
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password.toCharArray());
}
});
そして、これを使用してサイトに接続します。
Connection.Response res = Jsoup
.connect("https://somesite")
.execute();
Log.d("STATUSCODE", res.statusMessage());
ログインエラーを除いて、すべて問題なく処理できます。ログイン認証情報が間違っている場合でも、statusMessage()は常に OK と言い、 statuscode を 401 に設定する代わりに、 SocketTimeoutException をスローします。理由はありますか?