The classes should be named Server and Client, or else the Server.java & Client.Java files should be named MyServer.java & MyClient.java, respectively.
When you create a Docker container, 2 interfaces are created: localhost and another interface for communicating with other containers. You should change "localhost" to the server container IP or the host IP.
The java images are deprecated.
Also, there's no need for the EXPOSE directive in the client Dockerfile.