Source:
<code>public void testConnectionReplenishment() { AtomicInteger nextCorrelationId = new AtomicInteger(1); Function<Integer, List<RequestInfo>> requestGen = numRequests -> IntStream.range(0, numRequests) .mapToObj( i -> new RequestInfo(sslHost, sslPort, new MockSend(nextCorrelationId.getAndIncrement()), replicaOnSslNode)) .collect(Collectors.toList()); AtomicInteger expectedConnectCalls = new AtomicInteger(3); Runnable checkConnectCalls = () -> Assert.assertEquals(expectedConnectCalls.get(), selector.connectCallCount()); <START> networkClient.warmUpConnections(Collections.singletonList(replicaOnSslNode.getDataNodeId()), 100, 2000, <END> new ArrayList<>()); checkConnectCalls.run(); selector.setState(MockSelectorState.Good); List<ResponseInfo> responseInfoList = networkClient.sendAndPoll(requestGen.apply(3), 100); checkConnectCalls.run(); Assert.assertEquals(3, responseInfoList.size()); selector.setState(MockSelectorState.DisconnectOnSend); responseInfoList = networkClient.sendAndPoll(requestGen.apply(2), 100); checkConnectCalls.run(); Assert.assertEquals(2, responseInfoList.size()); selector.setState(MockSelectorState.Good); responseInfoList = networkClient.sendAndPoll(requestGen.apply(1), 100); expectedConnectCalls.addAndGet(2); checkConnectCalls.run(); Assert.assertEquals(1, responseInfoList.size()); selector.setState(MockSelectorState.Good); responseInfoList = networkClient.sendAndPoll(requestGen.apply(3), 100); checkConnectCalls.run(); Assert.assertEquals(3, responseInfoList.size()); }</code><technical_language>replace '100' '2000' static final ints</technical_language>

Target:
public void testConnectionReplenishment() { AtomicInteger nextCorrelationId = new AtomicInteger(1); Function<Integer, List<RequestInfo>> requestGen = numRequests -> IntStream.range(0, numRequests) .mapToObj( i -> new RequestInfo(sslHost, sslPort, new MockSend(nextCorrelationId.getAndIncrement()), replicaOnSslNode)) .collect(Collectors.toList()); int warmUpPercentage = 100; AtomicInteger expectedConnectCalls = new AtomicInteger(warmUpPercentage * 3 /100); Runnable checkConnectCalls = () -> Assert.assertEquals(expectedConnectCalls.get(), selector.connectCallCount()); networkClient.warmUpConnections(Collections.singletonList(replicaOnSslNode.getDataNodeId()), warmUpPercentage, TIME_FOR_WARM_UP_MS, new ArrayList<>()); checkConnectCalls.run(); selector.setState(MockSelectorState.Good); List<ResponseInfo> responseInfoList = networkClient.sendAndPoll(requestGen.apply(3), POLL_TIMEOUT_MS); checkConnectCalls.run(); Assert.assertEquals(3, responseInfoList.size()); selector.setState(MockSelectorState.DisconnectOnSend); responseInfoList = networkClient.sendAndPoll(requestGen.apply(2), POLL_TIMEOUT_MS); checkConnectCalls.run(); Assert.assertEquals(2, responseInfoList.size()); selector.setState(MockSelectorState.Good); responseInfoList = networkClient.sendAndPoll(requestGen.apply(1), POLL_TIMEOUT_MS); expectedConnectCalls.addAndGet(2); checkConnectCalls.run(); Assert.assertEquals(1, responseInfoList.size()); selector.setState(MockSelectorState.Good); responseInfoList = networkClient.sendAndPoll(requestGen.apply(3), POLL_TIMEOUT_MS); checkConnectCalls.run(); Assert.assertEquals(3, responseInfoList.size()); }