I have a testclass for testing my methods with RMI Connection.
First the testclass starts the RMI Server and then it starts 500 threads in a for-Loop.
Every thread starts a client which make a registry.lookup and tests my methods on serverside.
With about less than 215 threads I don't have any problem. But more than about 215 threads I get this exception:
java.net.ConnectException: Connection refused: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
at sun.rmi.server.UnicastRef.newCall(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Unknown Source)
I test it with port 1099 and the following ipAddresses:
- my ip Address
The test with starting server and all the clients runs on one machine.
Could this be the problem?