You probably need to connect to that port number because the service you want to access is listening on that port. The attempt to add the port number to the URL as you did is correct for such cases.
Now you may get a 'Connection refused'. This can happen if there is no process listening on the other side to accept the connection. It might even mean the service that is running is not interested in your connection. Remember some server processes can be configured to only accept connections with specific limitations.
You may also get something like 'No route to host', 'Unknown hostname' or stuff that indicates network problems. Another such network problem is a connection timeout, which today usually points towards a firewall denying access.
To summarize: Be aware you got a Connectexception. That means the TCP connection was not established - at that point in time HTTP was not started, and it does not matter whether you intend to GET or POST. I think you did well on the client side, maybe you need to check the server side why it does not accept your incoming connection.