title: Validating URL in Java
body: <p>I wanted to know if there is any standard APIs in Java to validate a given URL?
  I want to check both if the URL string is right i.e. the given protocol is valid and then to check if a connection can be established.</p>
  
  <p>I tried using HttpURLConnection, providing the URL and connecting to it.  The first part of my requirement seems to be fulfilled but when I try to perform HttpURLConnection.connect(), 'java.net.ConnectException: Connection refused' exception is thrown.</p>
  
  <p>Can this be because of proxy settings?  I tried setting the System properties for proxy but no success.</p>
  
  <p>Let me know what I am doing wrong.</p>