A socket has two end points - one on the client and one on the server, even if the client and server are on the same physical machine.
The first call creates the end point on the client side. ServerSocket.accept returns the end point on the server side. They are two different objects, but linked through the network.