コード例 #1
0
    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();
    }
コード例 #2
0
    @Override
    public void close() {

      transportService.stop();
      transportClientNodesService.close();
      try {
        terminate(threadPool);
      } catch (InterruptedException e) {
        throw new AssertionError(e);
      }
    }