title: URLConnection getting stuck and not throwing errors
body: <p>Below is my code. When I run this code it always gets stuck. Sometimes it runs the loop 100 times sometimes 3000. What is weird is that is does not throw an error it just gets stuck. Anybody have any ideas? </p>
  
  <pre><code>import java.io.IOException;
  import java.util.logging.Level;
  import java.util.logging.Logger;
  import us.monoid.web.Resty;
  
  
  public class Example1 {
  
  /**
   * @param args the command line arguments
   */
  public static void main(String[] args) {
  
      // Allow certificates - See http://en.wikibooks.org/wiki/Programming:WebObjects/Web_Services/How_to_Trust_Any_SSL_Certificate
      SSLUtilities.trustAllHostnames( );
      SSLUtilities.trustAllHttpsCertificates() ;
  
      // Variables
      int i = 0;
      String  askBidURL = "https://www.exchangebitcoins.com/data/depth";
  
       while(true){ 
  
         System.out.println("Example 1 - Run #" + i);
         Resty r = new Resty();
  
         try {String jsonw = r.text(askBidURL).toString();} 
         catch (IOException ex){Logger.getLogger(Example1.class.getName()).log(Level.SEVERE, null, ex); }
         i++;
  
     }
  }
  }
  </code></pre>