There are several reason leading to such error so you may check the following
- You have configured the settings correctly.
- Firewall in your system allows the connection (protocol, host & port)
- DNS servers configured in your network are able to resolve the host.
- Your ISP is not blocking your connection due to any reason
Since there is no fixed solution for your error, you may have to work a little hard to figure out the actual issue. You may also find some useful information from the log files if enabled.