@Test
  @Parameters(method = "parametersToTestSenderOrReceiverGoesDownDuringExecution")
  public void testSenderOrReceiverGoesDownDuringExecution(boolean useParallel,
      boolean usePartitionedRegion, Gateway gwToBeStopped, boolean stopPrimarySender)
      throws Exception {

    if (gwToBeStopped == Gateway.SENDER && (useParallel || stopPrimarySender)) {
      addIgnoredExceptionsForSenderInUseWentDown();
    }
    if (gwToBeStopped == Gateway.RECEIVER &&
        (usePartitionedRegion || !useParallel)) {
      addIgnoredExceptionsForReceiverConnectedToSenderInUseWentDown();
    }
    final int wanCopyRegionBatchSize = 10;
    final int entries;
    if (!useParallel && !usePartitionedRegion && stopPrimarySender) {
      entries = 2500;
    } else {
      entries = 1000;
    }

    final String regionName = getRegionName(usePartitionedRegion);

    // Site A
    VM locatorInA = vm0;
    VM server1InA = vm1;
    VM server2InA = vm2;
    VM server3InA = vm3;
    List<VM> serversInA = Arrays.asList(server1InA, server2InA, server3InA);
    final String senderIdInA = "B";

    // Site B
    VM locatorInB = vm4;
    VM server1InB = vm5;
    VM server2InB = vm6;
    VM server3InB = vm7;
    List<VM> serversInB = Arrays.asList(server1InB, server2InB, server3InB);
    VM client = vm8;

    int locatorAPort = create2WanSitesAndClient(locatorInA, serversInA, senderIdInA, locatorInB,
        serversInB, client, usePartitionedRegion, regionName);

    // Put entries
    client.invoke(() -> doPutsFrom(regionName, 0, entries));
    for (VM member : serversInA) {
      member.invoke(() -> validateRegionSize(regionName, entries));
    }

    // Create senders and receivers with replication as follows: "A" -> "B"
    if (useParallel) {
      createReceiverInVMs(server1InB, server2InB, server3InB);
      createSender(useParallel, serversInA, senderIdInA, 2);
    } else {
      // Senders will connect to receiver in server1InB
      server1InB.invoke(WANTestBase::createReceiver);
      createSender(useParallel, serversInA, senderIdInA, 2);
      createReceiverInVMs(server2InB, server3InB);
    }

    Callable<CommandResultAssert> wanCopyCommandCallable = () -> {
      String command = new CommandStringBuilder(WAN_COPY_REGION)
          .addOption(WAN_COPY_REGION__REGION, regionName)
          .addOption(WAN_COPY_REGION__SENDERID, senderIdInA)
          .addOption(WAN_COPY_REGION__BATCHSIZE, String.valueOf(wanCopyRegionBatchSize))
          .addOption(WAN_COPY_REGION__MAXRATE, "50")
          .getCommandString();
      try {
        gfsh.connectAndVerify(locatorAPort, GfshCommandRule.PortType.locator);
      } catch (Exception e) {
        errorCollector.addError(e);
      }
      return gfsh.executeAndAssertThat(command);
    };

    Future<CommandResultAssert> wanCopyCommandFuture =
        executorServiceRule.submit(wanCopyCommandCallable);

    // Wait for the wan-copy command to start
    waitForWanCopyRegionCommandToStart(useParallel, usePartitionedRegion, serversInA);

    // Stop sender or receiver and verify result
    if (gwToBeStopped == Gateway.SENDER) {
      stopSenderAndVerifyResult(useParallel, stopPrimarySender, server2InA, serversInA, senderIdInA,
          wanCopyCommandFuture);
    } else if (gwToBeStopped == Gateway.RECEIVER) {
      stopReceiverAndVerifyResult(useParallel, stopPrimarySender, entries, regionName, server1InB,
          server2InB, server3InB, serversInA.size(), wanCopyCommandFuture);
    }
  }
This test creates two sites A & B, each one containing 3 servers.
A region is created in both sites, and populated in site A.
After that replication is configured from site A to site B.
WanCopyRegionFunction is called, and while it is running, a sender in site A
or a receiver in site B are killed.
geode-wan/src/distributedTest/java/org/apache/geode/cache/wan/internal/cli/commands/WanCopyRegionCommandDistributedTest.java