In client server communication, typically one will get subclass of IOException if there is connection issue between the client and server. Based on the exact exception one can determine the possible causes.
Java application gets java.net.UnknownHostException: spatel because of following reasons,
- Cannot perform DNS lookup because of network issue
- Some of issue with DNS server itself
- Host’s IP address cannot be determined by DNS.
(The server url in this case was https://spatel:443/testapp)
Java application gets java.net.NoRouteToHostException: No route to host: connect because of following reasons
- When client is not able to reach the server because either server or intermediate router is down
- Some sort of network issue.
Java application gets java.net.ConnectException: Connection refused: connect because of following reasons
- When client is able to ping server but the said service is not running on the specified port.
- May be server is down or under maintenance.
Java application gets java.net.SocketException: Connection reset because of following reasons
- When server terminates the connection abruptly instead of sending the complete response and then properly terminating the connection.
- Server goes down while processing the request.
Java application gets java.net.SocketTimeoutException: Read timed out because of following reasons
- Client has specified read timeout or socket timeout on connection and server does not respond before this time out occurs.
- This may indicate the socket\read timeout on client is short, so the server is not responding as per agreed SLA.