Tell me more ×  Imagine the following code:  String hostName =
""; int port = 10002; int timeout = 5000; Socket socket = new
Socket(); socket.connect(new InetSocketAddress(hostName, port),
timeout);  On the Mac it works fine and executes the connect
(even with nothing running on port 10002) and on Windows I get
the following exception: Permission denied: connect  What's the
difference here and what would be the alternative on Windows?
This is used in unit tests.    share|improve this question I
didn't know it was possible to connect to the any address. Why
don't you use the loopback address? –  CodeCaster Aug 16 '12 at
7:34 The problem is that there are two nodes it's trying to
connect to and they need to be on different hosts and it's
already using the loopback address for the other one. So, the
designer of the test used that and it seems fine on the Mac and
Linux but not on Windows. I cannot use a random one because then
it will timeout. –  Jonas Aug 16 '12 at 7:42 @Jonas Who do you
want to connect to ? – 