public void testCallerUsesRemoteEndpointIfBusConnected() {
   runAfterInit(
       () -> {
         final Greeter greeter = IOC.getBeanManager().lookupBean(Greeter.class).getInstance();
         final CallerBean callerBean =
             IOC.getBeanManager().lookupBean(CallerBean.class).getInstance();
         callerBean
             .getOnlineServiceCaller()
             .call(
                 (r) -> {
                   assertEquals(greeter.online(), r);
                   finishTest();
                 })
             .greeting();
       });
 }
 public void testCallerUsesShadowServiceIfRemoteEndpointDoesntExist() {
   runAfterInit(
       () -> {
         final Greeter greeter = IOC.getBeanManager().lookupBean(Greeter.class).getInstance();
         final CallerBean callerBean =
             IOC.getBeanManager().lookupBean(CallerBean.class).getInstance();
         callerBean
             .getOfflineServiceCaller()
             .call(
                 (r) -> {
                   assertEquals(greeter.offline(), r);
                   finishTest();
                 })
             .greeting();
       });
 }
  public void testCallerUsesShadowServiceIfBusNotConnected() {
    runAfterInit(
        () -> {
          ((ClientMessageBusImpl) ErraiBus.get()).setState(BusState.CONNECTION_INTERRUPTED);

          final Greeter greeter = IOC.getBeanManager().lookupBean(Greeter.class).getInstance();
          final CallerBean callerBean =
              IOC.getBeanManager().lookupBean(CallerBean.class).getInstance();
          callerBean
              .getOnlineServiceCaller()
              .call(
                  (r) -> {
                    assertEquals(greeter.offline(), r);
                    finishTest();
                  })
              .greeting();
        });
  }