public List<String> getLiveBrokers() {
    List<String> brokerUrls = new ArrayList<>();
    try {
      byte[] brokerResourceNodeData = _zkClient.readData(BROKER_EXTERNAL_VIEW_PATH, true);
      brokerResourceNodeData = unpackZnodeIfNecessary(brokerResourceNodeData);
      JsonNode jsonObject = OBJECT_READER.readTree(getInputStream(brokerResourceNodeData));
      JsonNode brokerResourceNode = jsonObject.get("mapFields");

      Iterator<Entry<String, JsonNode>> resourceEntries = brokerResourceNode.fields();
      while (resourceEntries.hasNext()) {
        JsonNode resource = resourceEntries.next().getValue();
        Iterator<Entry<String, JsonNode>> brokerEntries = resource.fields();
        while (brokerEntries.hasNext()) {
          Entry<String, JsonNode> brokerEntry = brokerEntries.next();
          String brokerName = brokerEntry.getKey();
          if (brokerName.startsWith("Broker_") && "ONLINE".equals(brokerEntry.getValue().asText())) {
            brokerUrls.add(getHostPort(brokerName));
          }
        }
      }
    } catch (Exception e) {
      LOGGER.warn("Exception while reading External view from zookeeper", e);
      // ignore
    }
    return brokerUrls;
  }
@Test
  public void testGetLiveBrokers()
      throws IOException {
    // Setup
    final List<String> expectedResult = Arrays.asList("12.34.56.78:1234");
    when(_mockZkClient.readData(Mockito.anyString(), Mockito.anyBoolean())).thenReturn("json".getBytes());

    // Run the test
    final List<String> result = _externalViewReaderUnderTest.getLiveBrokers();

    // Verify the results
    assertEquals(expectedResult, result);
  }