private Object createProxy(Object target, boolean mockFromRemoteMV ) throws Exception {
// Setup the server side contianer..
ReflexiveInterceptor ri = new ReflexiveInterceptor(target);
DeMarshalingInterceptor demarshaller = new DeMarshalingInterceptor(ri, target.getClass().getClassLoader());
ProxyContainer serverContainer = new ProxyContainer(demarshaller);
Long dmiid = InterceptorRegistry.instance.register(demarshaller);
// Setup the client side container..
RemoteTransportInterceptor transport = new RemoteTransportInterceptor(URISupport.setFragment(connectURI, ""+dmiid));
IntraVMRoutingInterceptor localRouter = new IntraVMRoutingInterceptor(ri, dmiid, false);
InterVMRoutingInterceptor remoteRouter = new InterVMRoutingInterceptor(transport, localRouter);
if(mockFromRemoteMV) {
remoteRouter.setTargetVMID("THIS CRAP WILL NOT MATCH THE LOCAL VM ID");
}
ProxyContainer clientContainer = new ProxyContainer(remoteRouter);
return clientContainer.createProxy(target.getClass().getClassLoader(), target.getClass().getInterfaces());
}