title: Force exception while debugging
body: <p>Is it possible to force an exception to be thrown <strong><em>while debugging</em></strong>.</p>
  
  <p>Let me give you an example: I am debugging some code where I download a page from the internet. When the Internet connection is lost, or network card is down, an IOException should be thrown, BUT instead the execution is blocking (on the second line)</p>
  
  <pre><code>URLConnection connection = requestURL.openConnection();
  BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
  </code></pre>
  
  <p>I need a way to force throwing an exception <strong><em>while debugging</em></strong> when the code is blocking so I can jump to the catch block.</p>
  
  <p>I am using netbeans BTW.</p>
  
  <p><em><strong>While Debugging</em></strong> = added manually when the execution thread is paused.</p>
  
  <p><strong>EDIT</strong>: In other words, I need to inject - Invoke an exception while running, without affecting current code !</p>
  
  <p>Thank you.</p>