11package de .rwth .idsg .steve .utils ;
22
3+ import de .rwth .idsg .steve .SteveConfiguration ;
4+
35import java .net .HttpURLConnection ;
46import java .net .MalformedURLException ;
57import java .net .URL ;
@@ -18,13 +20,18 @@ private InternetChecker() { }
1820 private static final int CONNECT_TIMEOUT = 5_000 ;
1921
2022 private static final List <String > HOST_LIST = Arrays .asList (
23+ "https://treibhaus.informatik.rwth-aachen.de/heartbeat/" ,
2124 "https://github.com" ,
2225 "https://www.wikipedia.org" ,
2326 "https://www.google.com" ,
2427 "https://www.apple.com" ,
2528 "https://www.facebook.com"
2629 );
2730
31+ static {
32+ System .setProperty ("http.agent" , "SteVe/" + SteveConfiguration .CONFIG .getSteveVersion ());
33+ }
34+
2835 /**
2936 * We try every item in the list to compensate for the possibility that one of hosts might be down. If all these
3037 * big players are down at the same time, that's okay too, because the end of the world must have arrived,
@@ -44,10 +51,11 @@ private static boolean isHostAvailable(String str) {
4451 try {
4552 URL url = new URL (str );
4653 HttpURLConnection con = (HttpURLConnection ) url .openConnection ();
54+ con .setRequestProperty ("Connection" , "close" ); // otherwise, default setting is "keep-alive"
4755 try {
4856 con .setConnectTimeout (CONNECT_TIMEOUT );
4957 con .connect ();
50- if (con .getResponseCode () == 200 ) {
58+ if (con .getResponseCode () == HttpURLConnection . HTTP_OK ) {
5159 return true ;
5260 }
5361 } finally {
0 commit comments