title: Difference between connection timed out vs Tried all: '1' addresses, but could not connect over HTTP to server
body: <p>I am faced with two kinds of exceptions:</p>
  
  <p>Exception 1:</p>
  
  <p><code>java.net.SocketException: Connection timed out</code></p>
  
  <p>Exception 2:</p>
  
  <p><code>java.net.ConnectException: Tried all: '1' addresses, but could not connect over HTTP to server: 'java.sun.com', port: '80'</code></p>
  
  <p>The second one occurs when there is no service hosted on <code>java.sun.com:80</code>, but I couldn't figure out the first exception. It seems I am sending syn to host and the host welcomes me but is not sending syn + ack back. Am I right? I am not able to take tcp dump.</p>