@Override
  public void initWithNiwsConfig(IClientConfig clientConfig) {
    clientName = clientConfig.getClientName();
    vipAddresses = clientConfig.resolveDeploymentContextbasedVipAddresses();
    if (vipAddresses == null
        && ConfigurationManager.getConfigInstance()
            .getBoolean("DiscoveryEnabledNIWSServerList.failFastOnNullVip", true)) {
      throw new NullPointerException("VIP address for client " + clientName + " is null");
    }
    isSecure =
        Boolean.parseBoolean(
            "" + clientConfig.getProperty(CommonClientConfigKey.IsSecure, "false"));
    prioritizeVipAddressBasedServers =
        Boolean.parseBoolean(
            ""
                + clientConfig.getProperty(
                    CommonClientConfigKey.PrioritizeVipAddressBasedServers,
                    prioritizeVipAddressBasedServers));
    datacenter = ConfigurationManager.getDeploymentContext().getDeploymentDatacenter();
    targetRegion = (String) clientConfig.getProperty(CommonClientConfigKey.TargetRegion);

    // override client configuration and use client-defined port
    if (clientConfig.getPropertyAsBoolean(
        CommonClientConfigKey.ForceClientPortConfiguration, false)) {

      if (isSecure) {

        if (clientConfig.containsProperty(CommonClientConfigKey.SecurePort)) {

          overridePort =
              clientConfig.getPropertyAsInteger(
                  CommonClientConfigKey.SecurePort, DefaultClientConfigImpl.DEFAULT_PORT);
          shouldUseOverridePort = true;

        } else {
          logger.warn(
              clientName + " set to force client port but no secure port is set, so ignoring");
        }
      } else {

        if (clientConfig.containsProperty(CommonClientConfigKey.Port)) {

          overridePort =
              clientConfig.getPropertyAsInteger(
                  CommonClientConfigKey.Port, DefaultClientConfigImpl.DEFAULT_PORT);
          shouldUseOverridePort = true;

        } else {
          logger.warn(clientName + " set to force client port but no port is set, so ignoring");
        }
      }
    }
  }
  /** Set necessary parameters from client configuration and register with Servo monitors. */
  @Override
  public void initWithNiwsConfig(IClientConfig clientConfig) {
    if (clientConfig == null) {
      return;
    }
    vipAddresses = clientConfig.resolveDeploymentContextbasedVipAddresses();
    clientName = clientConfig.getClientName();
    if (clientName == null) {
      clientName = "default";
    }
    try {
      maxAutoRetries =
          Integer.parseInt(
              clientConfig
                  .getProperty(CommonClientConfigKey.MaxAutoRetries, maxAutoRetries)
                  .toString());
    } catch (Exception e) {
      logger.warn("Invalid maxRetries set for client:" + clientName);
    }
    try {
      maxAutoRetriesNextServer =
          Integer.parseInt(
              clientConfig
                  .getProperty(
                      CommonClientConfigKey.MaxAutoRetriesNextServer, maxAutoRetriesNextServer)
                  .toString());
    } catch (Exception e) {
      logger.warn("Invalid maxRetriesNextServer set for client:" + clientName);
    }

    try {
      Boolean bOkToRetryOnAllOperations =
          Boolean.valueOf(
              clientConfig
                  .getProperty(
                      CommonClientConfigKey.OkToRetryOnAllOperations, okToRetryOnAllOperations)
                  .toString());
      okToRetryOnAllOperations = bOkToRetryOnAllOperations.booleanValue();
    } catch (Exception e) {
      logger.warn("Invalid OkToRetryOnAllOperations set for client:" + clientName);
    }
    tracer = Monitors.newTimer(clientName + "_OperationTimer", TimeUnit.MILLISECONDS);
    Monitors.registerObject("Client_" + clientName, this);
  }