@Override
  public synchronized void initProxy() {
    // return if it is being used for WBCL or proxy is already created
    if (remoteDSId == DEFAULT_DISTRIBUTED_SYSTEM_ID
        || proxy != null && !proxy.isDestroyed()) {
      return;
    }

    int locatorCount = 0;
    PoolFactoryImpl pf = (PoolFactoryImpl) PoolManager.createFactory();
    pf.setPRSingleHopEnabled(false);
    if (locatorDiscoveryCallback != null) {
      pf.setLocatorDiscoveryCallback(locatorDiscoveryCallback);
    }
    pf.setReadTimeout(socketReadTimeout);
    pf.setIdleTimeout(connectionIdleTimeOut);
    pf.setSocketBufferSize(socketBufferSize);
    pf.setServerGroup(GatewayReceiver.RECEIVER_GROUP);
    RemoteLocatorRequest request =
        new RemoteLocatorRequest(remoteDSId, pf.getPoolAttributes().getServerGroup());
    String locators = cache.getInternalDistributedSystem().getConfig().getLocators();
    final boolean debugEnabled = logger.isDebugEnabled();
    if (debugEnabled) {
      logger
          .debug("Gateway Sender is attempting to configure pool with remote locator information");
    }
    StringTokenizer locatorsOnThisVM = new StringTokenizer(locators, ",");
    while (locatorsOnThisVM.hasMoreTokens()) {
      String localLocator = locatorsOnThisVM.nextToken();
      DistributionLocatorId locatorID = DistributionLocatorId.unmarshal(localLocator);
      try {
        final RemoteLocatorResponse response =
            (RemoteLocatorResponse) new TcpClient(SocketCreatorFactory
                .getSocketCreatorForComponent(SecurableCommunicationChannel.LOCATOR),
                InternalDataSerializer.getDSFIDSerializer().getObjectSerializer(),
                InternalDataSerializer.getDSFIDSerializer().getObjectDeserializer(),
                TcpSocketFactory.DEFAULT)
                    .requestToServer(locatorID.getHost(), request,
                        WanLocatorDiscoverer.WAN_LOCATOR_CONNECTION_TIMEOUT, true);

        if (response != null) {
          if (response.getLocators() == null) {
            if (logProxyFailure()) {
              logger.warn(
                  "Remote locator host port information for remote site {} is not available in local locator {}.",
                  remoteDSId, localLocator);
            }
            continue;
          }
          if (debugEnabled) {
            logger.debug("Received the remote site {} location information: {}", remoteDSId,
                response.getLocators());
          }
          for (final String remoteLocator : response.getLocators()) {
            try {
              DistributionLocatorId locatorId = DistributionLocatorId.unmarshal(remoteLocator);
              pf.addLocator(locatorId.getHost().getHostName(), locatorId.getPort());
              locatorCount++;
            } catch (Exception e) {
              if (logProxyFailure()) {
                logger.warn(
                    "Caught the following exception attempting to add remote locator {}. The locator will be ignored.",
                    remoteLocator, e);
              }
            }
          }
          break;
        }
      } catch (IOException ioe) {
        if (logProxyFailure()) {
          if (ioe instanceof ConnectException && !debugEnabled) {
            // don't print stack trace for connection failures
            logger.warn("GatewaySender {} is not able to connect to local locator {} : {}", id,
                localLocator, ioe);
          } else {
            logger.warn("GatewaySender {} is not able to connect to local locator {}", id,
                localLocator, ioe);
          }
        }
      } catch (ClassNotFoundException e) {
        if (logProxyFailure()) {
          logger.warn("GatewaySender {} is not able to connect to local locator {}", id,
              localLocator, e);
        }
      }
    }

    if (locatorCount == 0) {
      if (logProxyFailure()) {
        logger.fatal(
            "GatewaySender {} could not get remote locator information for remote site {}.", id,
            remoteDSId);
      }
      proxyFailureTries++;
      throw new GatewaySenderConfigurationException(
          String.format(
              "GatewaySender %s could not get remote locator information for remote site %s.",
              id, remoteDSId));
    }
    pf.init(this);
    proxy = ((PoolImpl) pf.create(getId()));
    if (proxyFailureTries > 0) {
      logger.info(
          "GatewaySender {} got remote locator information for remote site {} after {} failures in connecting to remote site.",
          id, remoteDSId, proxyFailureTries);
      proxyFailureTries = 0;
    }
  }
used to reduce warning logs in case remote locator is down
geode-wan/src/main/java/org/apache/geode/cache/wan/internal/AbstractRemoteGatewaySender.java