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(); }
@Override public void close() { transportService.stop(); transportClientNodesService.close(); try { terminate(threadPool); } catch (InterruptedException e) { throw new AssertionError(e); } }