@Override
  public void captureData(PrintWriter writer) {
    writer.println("<html>");
    writer.println("<h1>Channelz</h1>");
    appendTopChannels(writer);
    writer.println("</html>");
  }
@Test
  public void testRendersAllChannels() throws UnsupportedEncodingException {
    String windmill1 = "WindmillHost1";
    String windmill2 = "WindmillHost2";
    String nonWindmill1 = "NonWindmillHost1";
    String someOtherHost1 = "SomeOtherHost2";
    ManagedChannel[] unusedChannels =
        new ManagedChannel[] {
          InProcessChannelBuilder.forName(windmill1).build(),
          InProcessChannelBuilder.forName(windmill2).build(),
          InProcessChannelBuilder.forName(nonWindmill1).build(),
          InProcessChannelBuilder.forName(someOtherHost1).build()
        };
    DataflowWorkerHarnessOptions options =
        PipelineOptionsFactory.create().as(DataflowWorkerHarnessOptions.class);
    FakeWindmillServer fakeWindmillServer =
        new FakeWindmillServer(new ErrorCollector(), s -> Optional.empty());
    fakeWindmillServer.setWindmillServiceEndpoints(
        ImmutableSet.of(HostAndPort.fromHost(windmill1), HostAndPort.fromHost(windmill2)));
    options.setChannelzShowOnlyWindmillServiceChannels(false);
    ChannelzServlet channelzServlet =
        new ChannelzServlet("/channelz", options, fakeWindmillServer::getWindmillServiceEndpoints);
    StringWriter stringWriter = new StringWriter();
    PrintWriter writer = new PrintWriter(stringWriter);
    channelzServlet.captureData(writer);
    writer.flush();
    String channelzData = stringWriter.toString();
    assertTrue(channelzData.contains(windmill1));
    assertTrue(channelzData.contains(windmill2));
    assertTrue(channelzData.contains(nonWindmill1));
    assertTrue(channelzData.contains(someOtherHost1));
  }