I've successfully used ObjectOutputStream and ObjectInputStream to serialize and deserialize objects for a server and client I am writing. The server and client are usually on two different machines, but since It's going to be a turn based card game, I also want the users to play locally and then both the client and the server will run on the same machine.
Now, I'm writing an alternative implementation of my connection interface. The interface contains the methods such as void sendToServer(Object) and Object receiveFromServer()
Usually the sendToServer(Object) function will just send the object through an ObjectOutputStream, but since the objects are on the same machine, I could just create a queue of Objects and push and pop each time the send or receive is called. The problem, however, is that I don't want the client to have a reference to the object the server uses, I want it to be a copy. And i don't have a copy constructor and the objects are not cloneable.
What would you do in my situation?