If you are getting java.net.ConnectionException, it means no port is listening your request.Following are the condition which will give this exception.
- You are trying to connect wrong port.
- You have not started your server.
- Your server is not listening to the request.
Before running the server:
- You should check the port number and host name.
- There should not be any firewall, which will restrict the connection.