title: Jsoup, determine between a timeout and a 404
body: <p>I'm trying to figure out the logic of how to check if a url is 404'ing or if it is timing out. I can't seem to figure it out!</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>while (i &lt; retries){
              try {
                  response = Jsoup.connect(url)
                          .userAgent("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.21 (KHTML, like Gecko) Chrome/19.0.1042.0 Safari/535.21")
                          .timeout(10000)
                          .execute();
                  success = true;
                  break;
              } catch (IOException e) {
                  success = false;
              }
              System.out.println("Attempt " + i + " " + url);
              i++;
          }
      }
  
      public int getUrlStatus(){
          if(success){
              int statusCode = response.statusCode();
              return statusCode;
          }else {
              return 404;
          }
      }
  </code></pre>
  
  <p>From what I can understand this will tell me that a page 404's not if a page timesout. How can I check for that?</p>