@Test
public void checkProxyDynamism() throws NamingException
{

  BundleMock mock = new BundleMock("scooby.doo", new Properties());
  
  Thread.currentThread().setContextClassLoader(mock.getClassLoader());
  InitialContext ctx = new InitialContext();
  
  String className = Runnable.class.getName();
  
  Runnable t = Skeleton.newMock(Runnable.class);
  Runnable t2 = Skeleton.newMock(Runnable.class);
  
  // we don't want the default service
  reg.unregister();
  
  ServiceRegistration reg = bc.registerService(className, t, null);
  bc.registerService(className, t2, null);
  
  Runnable r = (Runnable) ctx.lookup("osgi:service/java.lang.Runnable");
  
  r.run();
  
  Skeleton.getSkeleton(t).assertCalledExactNumberOfTimes(new MethodCall(Runnable.class, "run"), 1);
  Skeleton.getSkeleton(t2).assertNotCalled(new MethodCall(Runnable.class, "run"));
  
  reg.unregister();
  
  r.run();
  
  Skeleton.getSkeleton(t).assertCalledExactNumberOfTimes(new MethodCall(Runnable.class, "run"), 1);
  Skeleton.getSkeleton(t2).assertCalledExactNumberOfTimes(new MethodCall(Runnable.class, "run"), 1);
}