Dispatcher { protected void execute(Reference reference, final List<Object> argList) { String serviceName = reference.getObjectId(); String methodName = reference.getMethodName(); log.info(serviceName + ":" + methodName + " called"); final Object service = services.get(serviceName); if (service == null) { log.warn("Could not find object to handle {} ", serviceName); return; } final Object[] args = new Object[argList.size()]; int idx = 0; for (Object o : argList) { args[idx++] = o; } final Method m = getConformingMethod(methodName, args, serviceToClass.get(service)); if (m == null) { log.error("Could not find method to handle {}" , methodName); return; } tp.execute(new Runnable() { public void run() { try { m.setAccessible(true); m.invoke(service, args); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } }); } protected  Dispatcher(Bridge bridge); Reference storeRandomObject(Object object);  }
@Test public void testExecute() { Reference destination = Reference.createClientReference(bridge, "doesNotExist", null); destination.setMethodName("some method"); List<Object> args = Arrays.asList(new Object[] {}); dispatcher.execute(destination, args); dispatcher.execute(destination, args); destination.setMethodName("aMethod"); dispatcher.execute(destination, args); }