I have a server to which a client computer connects. I recently decided to encrypt the connection using stunnel, so now the client program does not connect directly to the server, but to localhost: 8045 (I checked, and this port is not busy).
Java Code:
URL url = new URL("http://localhost:8045/malibu/GetProviders"); InputStream stream = url.openStream();
And I get the following:
java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:519) at java.net.Socket.connect(Socket.java:469) at java.net.Socket.<init>(Socket.java:366) at java.net.Socket.<init>(Socket.java:180) . . .
If I try to request the same page using curl , everything will be fine.
What can cause this behavior?
EDIT: Yes, there is a listening socket - netstat -avn | grep 8045 netstat -avn | grep 8045 :
tcp6 0 0 ::1:8045 :::* LISTEN
source share