How-to articles, tricks, and solutions about TCP

java.net.ConnectException: Connection refused

The java.net.ConnectException: Connection refused exception is thrown when an application tries to connect to a remote host, but the connection is refused by the host. This can happen for several reasons, such as: