TestIteration() {
      threadPool = new ThreadPool("transport-client-nodes-service-tests");
      transport =
          new FailAndRetryMockTransport<TestResponse>(getRandom()) {
            @Override
            protected TestResponse newResponse() {
              return new TestResponse();
            }
          };
      transportService = new TransportService(Settings.EMPTY, transport, threadPool);
      transportService.start();
      transportClientNodesService =
          new TransportClientNodesService(
              Settings.EMPTY,
              ClusterName.DEFAULT,
              transportService,
              threadPool,
              Headers.EMPTY,
              Version.CURRENT);

      nodesCount = randomIntBetween(1, 10);
      for (int i = 0; i < nodesCount; i++) {
        transportClientNodesService.addTransportAddresses(new LocalTransportAddress("node" + i));
      }
      transport.endConnectMode();
    }
    TestIteration() {
      ClusterName clusterName = new ClusterName("test");
      threadPool = new TestThreadPool("transport-client-nodes-service-tests");
      transport =
          new FailAndRetryMockTransport<TestResponse>(random(), clusterName) {
            @Override
            public List<String> getLocalAddresses() {
              return Collections.emptyList();
            }

            @Override
            protected TestResponse newResponse() {
              return new TestResponse();
            }
          };
      transportService =
          new TransportService(Settings.EMPTY, transport, threadPool, clusterName) {
            @Override
            public <T extends TransportResponse> void sendRequest(
                DiscoveryNode node,
                String action,
                TransportRequest request,
                final TransportResponseHandler<T> handler) {
              if (TransportLivenessAction.NAME.equals(action)) {
                super.sendRequest(
                    node, action, request, wrapLivenessResponseHandler(handler, node, clusterName));
              } else {
                super.sendRequest(node, action, request, handler);
              }
            }

            @Override
            public <T extends TransportResponse> void sendRequest(
                DiscoveryNode node,
                String action,
                TransportRequest request,
                TransportRequestOptions options,
                TransportResponseHandler<T> handler) {
              if (TransportLivenessAction.NAME.equals(action)) {
                super.sendRequest(
                    node,
                    action,
                    request,
                    options,
                    wrapLivenessResponseHandler(handler, node, clusterName));
              } else {
                super.sendRequest(node, action, request, options, handler);
              }
            }
          };
      transportService.start();
      transportService.acceptIncomingRequests();
      transportClientNodesService =
          new TransportClientNodesService(
              Settings.EMPTY, clusterName, transportService, threadPool, Version.CURRENT);
      this.nodesCount = randomIntBetween(1, 10);
      for (int i = 0; i < nodesCount; i++) {
        transportClientNodesService.addTransportAddresses(new LocalTransportAddress("node" + i));
      }
      transport.endConnectMode();
    }