public static List<URI> getPeerServerURIs(HelixManager helixManager, String tableNameWithType, String segmentName,
      String downloadScheme) {
    HelixAdmin helixAdmin = helixManager.getClusterManagmentTool();
    String clusterName = helixManager.getClusterName();
    List<URI> onlineServerURIs = new ArrayList<>();
    try {
      RetryPolicies.exponentialBackoffRetryPolicy(MAX_NUM_ATTEMPTS, INITIAL_DELAY_MS, DELAY_SCALE_FACTOR)
          .attempt(() -> {
            getOnlineServersFromExternalView(helixAdmin, clusterName, tableNameWithType, segmentName, downloadScheme,
                onlineServerURIs);
            return !onlineServerURIs.isEmpty();
          });
    } catch (AttemptsExceededException e) {
      LOGGER.error("Failed to find ONLINE servers for segment: {} in table: {} after {} attempts", segmentName,
          tableNameWithType, MAX_NUM_ATTEMPTS);
    } catch (Exception e) {
      LOGGER.error("Caught exception while getting peer server URIs for segment: {} in table: {}", segmentName,
          tableNameWithType, e);
    }
    return onlineServerURIs;
  }
@Test
  public void testSegmentFoundSuccessfully()
      throws Exception {
    // SEGMENT_1 has only 2 online replicas.
    List<URI> httpServerURIs = PeerServerSegmentFinder.getPeerServerURIs(_helixManager, REALTIME_TABLE_NAME, SEGMENT_1,
        CommonConstants.HTTP_PROTOCOL);
    assertEquals(httpServerURIs.size(), 2);
    assertTrue(httpServerURIs.contains(new URI(
        String.format("http://%s:%d/segments/%s/%s", HOSTNAME_1, HTTP_ADMIN_PORT, REALTIME_TABLE_NAME, SEGMENT_1))));
    assertTrue(httpServerURIs.contains(new URI(
        String.format("http://%s:%d/segments/%s/%s", HOSTNAME_3, HTTP_ADMIN_PORT, REALTIME_TABLE_NAME, SEGMENT_1))));
    List<URI> httpsServerURIs = PeerServerSegmentFinder.getPeerServerURIs(_helixManager, REALTIME_TABLE_NAME, SEGMENT_1,
        CommonConstants.HTTPS_PROTOCOL);
    assertEquals(httpsServerURIs.size(), 2);
    assertTrue(httpsServerURIs.contains(new URI(
        String.format("https://%s:%d/segments/%s/%s", HOSTNAME_1, HTTPS_ADMIN_PORT, REALTIME_TABLE_NAME, SEGMENT_1))));
    assertTrue(httpsServerURIs.contains(new URI(
        String.format("https://%s:%d/segments/%s/%s", HOSTNAME_3, HTTPS_ADMIN_PORT, REALTIME_TABLE_NAME, SEGMENT_1))));
  }