When writing integration tests for code that will use RMI communication in production, I usually connect the client to a locally instantiated instance of the Remote object. However, because parameters and return values are treated differently for local and RMI method invocations, my integration tests are not completely correct. Sometimes I write an intermediary that makes copies of parameters, etc. to simulate what RMI would do, but this is less than ideal.
Is there a testing tool out there somewhere that can simulate RMI method invocation behaviour for unit/integration tests? Perhaps it would look something like:
MyRemoteInterface remote = new MysteryRmiTool(new MyRemoteObject());
Object someResult = remote.someMethod(someParameter);//tool makes copies of someParameter and someResult (unless they implement Remote, of course)