public static void stopGatewaySender(final VM vm) {
    SerializableRunnable stopGatewaySender = new SerializableRunnable("Stop Gateway Sender") {
      @Override
      public void run() {
        ManagementService service = ManagementService.getManagementService(cache);
        GatewaySenderMXBean bean = service.getLocalGatewaySenderMXBean("pn");
        bean.stop();
        assertThat(bean.isRunning()).isFalse();
      }
    };
    vm.invoke(stopGatewaySender);
  }
stops a gateway sender

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