title: Asynctask hangs on getInputStream()
body: <p>I've been working at this part of my Android app for hours and I've read at least 50 related posts, but none of them have helped. I have an AsyncTask that attempts to grab text from a website. This should be very simple.</p>
  
  <p>I already have a Java Swing program that calls very similar code that works exactly how I want it to so I know the website and my internet are up and running. </p>
  
  <p>When I try to run the app the AsyncTask hangs at the commented point and I don't know why. </p>
  
  <p><strong>Stripped version of the AsyncTask innards:</strong></p>
  
  <pre><code>@Override
  protected void onPreExecute() {
      Log.wtf("PROGRESS", "in preex");
      //progress bar
  }
  
  @Override
  protected String doInBackground(Void... params) {
      android.os.Process.setThreadPriority(THREAD_PRIORITY_BACKGROUND + THREAD_PRIORITY_MORE_FAVORABLE);
  
      try {
          Log.wtf("PROGRESS", "in try");
          URLConnection connection = new URL("https://bmorgan17.github.io/html-database/").openConnection();
          Log.wtf("PROGRESS", "connect");
          Scanner scanner = new Scanner(connection.getInputStream()); //HANGS HERE
          Log.wtf("PROGRESS", "got stream");
          scanner.useDelimiter("\\Z");
          string = scanner.next();
          Log.wtf("PROGRESS", "read");
          scanner.close();
      } catch ( Exception ex ) {
          ex.printStackTrace();
          Log.wtf("FAILED", "Hard rip mate");
      }
  
      return string;
  }
  
  @Override
  protected void onPostExecute(String s) {
      Log.wtf("PROGRESS", "in post");
      //hide progress bar
      delegate.processFinish(s);
  }
  </code></pre>
  
  <p><strong>Logcat:</strong></p>
  
  <pre><code>01-21 13:36:53.039 14480-14480/com.example.name.stemapp A/PROGRESS: in preex
  01-21 13:36:53.109 14480-14495/com.example.name.stemapp A/PROGRESS: in try
  01-21 13:36:53.125 14480-14495/com.example.name.stemapp A/PROGRESS: connect
  </code></pre>
  
  <p>The progress wheel continues to spin forever after the final logcat entry, any help would be greatly appreciated.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>In the time it took to create this post and 15-20 minutes of Reddit surfing, the app finally moved on. It entered the catch statement and then postExecute which is obviously not what I intend. If anyone could help me solve this new problem it would be great.</p>
  
  <p><strong>Logcat:</strong></p>
  
  <pre><code>A/PROGRESS: in preex
  A/PROGRESS: in try
  A/PROGRESS: connect
  A/FAILED: hard rip mate
  A/PROGRESS: in post
  </code></pre>