title: W/System: A resource failed to call end. When using HttpsURLConnection - Android
body: <p>In the logcat I get a warning:
  <strong>W/System: A resource failed to call end.</strong></p>
  <p>I am 100% positive that this piece of code makes the warning, since when I take it out it stops.
  I can't seem to fix it so it doesn't display warning.</p>
  <p>The purpose of the  code is to check if there is internet connection or not.</p>
  <p>It is on separate thread. Declared with:</p>
  <pre><code>public class ConnectWifiThread extends Thread {
  public static boolean isInternetAvailable(Context context) {
  </code></pre>
  <p><strong>Here is the code:</strong></p>
  <pre><code>try {
      URL url = new URL(&quot;https://www.google.com/&quot;);
      HttpsURLConnection https = (HttpsURLConnection) url.openConnection();
  
      https.setRequestProperty(&quot;User-Agent&quot;, &quot;test&quot;);
      https.setRequestProperty(&quot;Connection&quot;, &quot;close&quot;);
      https.setConnectTimeout(2000); // mTimeout is in seconds
      https.connect();
  
      int tempResponse = https.getResponseCode();
  
      if (tempResponse == 200) {
          https.disconnect();
          Thread.sleep(50);
          https=null;
          url=null;
  
          Thread.sleep(50);
          Log.d(&quot;Has&quot;, &quot;internet&quot;);
          return true;
      } else {
          https.disconnect();
          Thread.sleep(50);
          https=null;
          url=null;
          Thread.sleep(50);
          Log.d(&quot;NO&quot;, &quot;internet&quot;);
          return false;
      }
  } catch (MalformedURLException e) {
      e.printStackTrace();
      return false;
  } catch (IOException e) {
      e.printStackTrace();
      return false;
  }
  catch (Exception e) {
      Log.d(&quot;Error checking internet&quot;, e.getMessage());
      return false;
  }
  </code></pre>
  <p>Thank you</p>