code: public static boolean checkServerConnection(String serverURL) {
          boolean value = false;
          try {
              value = new RetrieveCheckServerConnectionString().execute(serverURL).get();
          } catch (InterruptedException e) {
              QuickUtils.log.e("InterruptedException", e);
          } catch (ExecutionException e) {
              QuickUtils.log.e("ExecutionException", e);
          }
          return value;
      }
docs: Check if can connect to the server, also this method will need the
  permissions "android.permission.INTERNET"
  
  @param serverURL - server url
  @return true if the connection returned a successful code