AsyncService implements Async { public <T> T mediate(final T service, final Class<T> iface) { return AccessController.doPrivileged(new PrivilegedAction<T>() { public T run() { return privMediate(service, iface); } }); } AsyncService(Bundle clientBundle, ExecutorService executor, ScheduledExecutorService ses, ServiceTracker<LogService, LogService> logServiceTracker); T mediate(final T service, final Class<T> iface); T mediate(final ServiceReference<? extends T> ref, final Class<T> iface); Promise<T> call(T call); Promise<?> call(); Promise<Void> execute();  }
@Test public void testMultipleMediationsCacheClassLoader() throws Exception { DelayedEcho raw = new DelayedEcho(); AsyncService service = new AsyncService(null, es, ses, serviceTracker); DelayedEcho mediated = service.mediate(raw, DelayedEcho.class); assertSame(mediated.getClass(), service.mediate(raw, DelayedEcho.class).getClass()); }
@Test public void testMultipleMediationsCacheClassLoaderInterface() throws Exception { CharSequence raw = "test"; AsyncService service = new AsyncService(null, es, ses, serviceTracker); CharSequence mediated = service.mediate(raw, CharSequence.class); assertSame(mediated.getClass(), service.mediate(raw, CharSequence.class).getClass()); }