InetAddress.getLocalHost() does not always give the correct IP. Use a method that checks network interfaces
Make sure firewalls are not blocking it
Make sure you're on the same local network
Finally, use the correct IP and port of the other party to establish a connection