@Test
  public void testUsingProxy() {
    VMMessageBroker broker = new VMMessageBroker();
    broker.clear();
    FirstImpl first = new FirstImpl();
    SecondImpl second = new SecondImpl();
    broker.addSubscriber(first);
    broker.addSubscriber(second);

    DoSomethingInterface firstProxy = broker.createPublisher(DoSomethingInterface.class);
    DoSomethingInterface secondProxy = broker.createPublisher(DoSomethingInterface.class);

    firstProxy.doThis();

    Assert.assertEquals(1, first.getCount());
    Assert.assertEquals(1, second.getCount());

    broker.removeSubscriber(secondProxy); // making sure we can unregister the
    // proxy
    firstProxy.doThis();

    Assert.assertEquals(2, first.getCount());
    Assert.assertEquals(2, second.getCount());

    secondProxy.doThis();

    Assert.assertEquals(3, first.getCount());
    Assert.assertEquals(3, second.getCount());
  }
  @Test
  public void test() {
    VMMessageBroker broker = new VMMessageBroker();
    FirstImpl first = new FirstImpl();
    broker.addSubscriber(first);
    SecondImpl second = new SecondImpl();
    broker.addSubscriber(second);
    ((DoSomethingInterface) broker.createPublisher(DoSomethingInterface.class)).doThis();

    Assert.assertEquals(1, first.getCount());
    Assert.assertEquals(1, second.getCount());

    broker.removeSubscriber(second);
    ((DoSomethingInterface) broker.createPublisher(DoSomethingInterface.class)).doThis();

    Assert.assertEquals(2, first.getCount());
    Assert.assertEquals(1, second.getCount());
  }