Αγκόρι τα Exceptions του java.net είναι:
Exception Summary
BindException Signals that an error occurred while attempting to bind a socket to a local address and port.
ConnectException Signals that an error occurred while attempting to connect a socket to a remote address and port.
HttpRetryException Thrown to indicate that a HTTP request needs to be retried but cannot be retried automatically, due to streaming mode being enabled.
MalformedURLException Thrown to indicate that a malformed URL has occurred.
NoRouteToHostException Signals that an error occurred while attempting to connect a socket to a remote address and port.
PortUnreachableException Signals that an ICMP Port Unreachable message has been received on a connected datagram.
ProtocolException Thrown to indicate that there is an error in the underlying protocol, such as a TCP error.
SocketException Thrown to indicate that there is an error in the underlying protocol, such as a TCP error.
SocketTimeoutException Signals that a timeout has occurred on a socket read or accept.
UnknownHostException Thrown to indicate that the IP address of a host could not be determined.
UnknownServiceException Thrown to indicate that an unknown service exception has occurred.
URISyntaxException Checked exception thrown to indicate that a string could not be parsed as a URI reference.
πηγήΔηλαδή το
MalformedURLException που χρησιμοποιείς πιάνει ένα url που δεν είναι σωστά σχηματισμένο.
Εσύ μάλλον θέλεις το
ConnectException που πιάνει σφάλμα κατά τη σύνδεση σε remote address και port ή
το
UnknownHostException που πιάνει ότι το domain name δεν μπόρεσε να γίνει resolved.
Καλύτερα το 1ο imo. Δες τα και πες αν είσαι οκ με αυτό.