title: How to check whether the connection is established or not in java?
body: <p>I want to establish a connection using a url but i am getting IO exception because my server is not up . i want to check whether my connection is established or not how can i acheive this in java. here is my code</p>
  
  <pre><code>URLConnection connection = new URL(configurationManagement.getValue(url)).openConnection();
              connection.setRequestProperty("Accept-Charset", charset);
              connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401"); // Do as if you'rusing Firefox 3.6.3
              InputStream response = connection.getInputStream();
  </code></pre>
  
  <p>Can anybody help ?</p>