title: How to handle switch from 3G to WIFI? UrlConnection TimeOut does not throw Exception
body: <p>My application needs to download some big Files. I use a service for the download an show the progress in a notification. The problem is that during that download time the user can switch from 3g to WIFI. In that case the progress stops but no exception is thrown.
  How do I handle this situation properly?</p>
  
  <pre><code>URL url = new URL(myurl);
  URLConnection conexion = url.openConnection();
  conexion.setReadTimeout(10000);
  conexion.setConnectTimeout(10000);
  conexion.connect();
  int lenghtOfFile = conexion.getContentLength();
  // downlod the file
  InputStream input = new BufferedInputStream(url.openStream());
  OutputStream output = new FileOutputStream(targetFilePath);
  
  byte data[] = new byte[1024];
  
  long total = 0;
  while ((count = input.read(data)) != -1) {
      total += count;
      // publishing the progress....
      updateProgress(downloadNM, downloadNotification, (int)total*100/lenghtOfFile);
      output.write(data, 0, count);
  }
  output.flush();
  output.close();
  input.close();
  </code></pre>