Common Exceptions
Many exceptions should be self explanatory. However here are some common
exceptions that can be thrown by HTTPClient (they're all subclasses of
java.io.IOException) and for which the true cause might not be obvious.
- java.net.SocketException: Connection refused
- (connecting to the local host) The server is not running (nobody
is listening on the specified port).
- java.net.SocketException: Invalid argument
- (connecting to a different host) The server is not running (nobody
is listening on the specified port).
- (connecting to a different host) The host is not reachable.
- java.net.UnknownHostException: host
- The host name host could not be translated to an IP-address.
- java.net.SocketException: Malformed reply from SOCKS server
- The SOCKS server refused the connection.
- The SOCKS server is running version 5; the JDK currently only
supports version 4.
Also note the following: If you try to create a new connection, giving
an IP-address instead of a host name (e.g. new
HTTPConnection("12.34.32.127")
) and this fails with an IOException
then it might be due to the problem described in
http://java.sun.com/products/JDK/1.0.2/KnownBugs.html#Net. A fix is
available at
http://www.cdt.luth.se/~peppar/java/InetAddress/.
If you have any further exceptions that you think should be listed here,
please let me know.
Ronald Tschalär / 23 March 1997 /
ronald@innovation.ch.