I'm trying to establish RMI Client Server connectivity where Client and Server are behind different NAT/Firewall using TCP Hole punching mechanism. Currently, I could get the connectivity between client and Server using their Public Ip and port "80". After TCP connection is established I could retrieve the Stub info of RMIServer. Also, I could netstat and see the connection established.
But When trying read the remote object I'm getting following exception
java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
java.net.SocketTimeoutException: Read timed out
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:293)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:190)
On monitoring the connectivity with netstat, I could see the TCP connection gets terminated immediately and its not stable. It would be helpful If I could get any hints on how to maintain or get a stable TCP connection.
Thanks.