proxy settings: check connection: get HTTP response code to verify connection is ok

This commit is contained in:
irengrig
2013-01-31 15:55:55 +04:00
parent 725bca9764
commit b25108ef27
@@ -164,6 +164,10 @@ public class HTTPProxySettingsPanel implements SearchableConfigurable, Configura
connection.setReadTimeout(3 * 1000);
connection.setConnectTimeout(3 * 1000);
connection.connect();
final int code = connection.getResponseCode();
if (HttpURLConnection.HTTP_OK != code) {
exc[0] = new IOException("Error code: " + code);
}
}
catch (IOException e1) {
exc[0] = e1;