title: How do I know if I have successfully connected to the URL I opened a connection with?
body: <p>To check if I can connect to the web-app named <em>service</em> I open a connection to its address.How do I check if have connected to this <em>URL/Service</em> ? I was thinking of sending some sort of status method (as a client tries to open connection to this URL) that determines if the client was able to establish a successful connection to the <em>service</em>. But how do I do that ?</p>
  
  <p>I was trying something like this :           </p>
  
  <pre><code>          final URL url = new URL("http://localhost:8084/service/index.jsp");
            final URLConnection urlc = url.openConnection();
            InputStream response = urlc.getInputStream();
            // Now call a method in the service app that sends a status method...
            // .....or can I get away with this ?
  </code></pre>