Good Night,
Java RMI (Remote Method Invocation), is a mechanism that let the user, create distributed applications using Java. It takes care of Sockets, protocols and others. But how it works? All the magic is done by RMI. It have a server named RMIREGISTRY, where your server connect and says "I'm here". After this Clients can connect to RMIREGISTRY and find the server that it wants.
I will show you an example of a Car Advertisement server, where Clients can add and search for Vehicle.