public Optional<CliFunctionResult> connectIfNeeded(String memberName,
        GatewaySender sender) {
      if (senderPool == null) {
        senderPool = ((AbstractGatewaySender) sender).getProxy();
        if (senderPool == null) {
          return Optional.of(new CliFunctionResult(memberName,
              CliFunctionResult.StatusState.ERROR,
              WAN_COPY_REGION__MSG__NO__CONNECTION__POOL));
        }
        connection = senderPool.acquireConnection();
        if (connection.getWanSiteVersion() < KnownVersion.GEODE_1_15_0.ordinal()) {
          return Optional.of(new CliFunctionResult(memberName,
              CliFunctionResult.StatusState.ERROR,
              WAN_COPY_REGION__MSG__COMMAND__NOT__SUPPORTED__AT__REMOTE__SITE));
        }
      }
      return Optional.empty();
    }
It runs the actions to be done after a batch has been
sent: throw an interrupted exception if the operation was canceled and
adjust the rate of copying by sleeping if necessary.

@param startTime time at which the entries started to be copied
@param copiedEntries number of entries copied so far
@param maxRate maximum copying rate
geode-wan/src/main/java/org/apache/geode/management/internal/cli/functions/WanCopyRegionFunctionDelegate.java