public static void checkSenderMBean(final VM vm, final String regionPath, boolean connected) {
    SerializableRunnable checkMBean = new SerializableRunnable("Check Sender MBean") {
      @Override
      public void run() {
        ManagementService service = ManagementService.getManagementService(cache);

        GatewaySenderMXBean bean = service.getLocalGatewaySenderMXBean("pn");
        assertThat(bean).isNotNull();
        await()
            .untilAsserted(() -> assertThat(bean.isConnected()).isEqualTo(connected));

        ObjectName regionBeanName = service.getRegionMBeanName(
            cache.getDistributedSystem().getDistributedMember(), SEPARATOR + regionPath);
        RegionMXBean rBean = service.getMBeanInstance(regionBeanName, RegionMXBean.class);
        assertThat(rBean.isGatewayEnabled()).isTrue();


      }
    };
    vm.invoke(checkMBean);
  }
Checks whether a GatewayReceiverMBean is created or not

@param vm reference to VM
geode-wan/src/distributedTest/java/org/apache/geode/internal/cache/wan/WANTestBase.java