private void doTestWarmUpConnections(List<DataNodeId> localDataNodeIds, int maxPort, PortType expectedPortType) {
    Assert.assertEquals("Port type is not expected.", expectedPortType,
        localDataNodeIds.get(0).getPortToConnectTo().getPortType());
    Assert.assertEquals("Connection count is not expected", 0,
        networkClient.warmUpConnections(localDataNodeIds, 0, TIME_FOR_WARM_UP_MS, new ArrayList<>()));
    selector.setState(MockSelectorState.FailConnectionInitiationOnPoll);
    Assert.assertEquals("Connection count is not expected", 0,
        networkClient.warmUpConnections(localDataNodeIds, 100, TIME_FOR_WARM_UP_MS, new ArrayList<>()));
    selector.setState(MockSelectorState.Good);
    int halfConnections = 50 * maxPort / 100 * localDataNodeIds.size();
    int allConnections = maxPort * localDataNodeIds.size();
    Assert.assertEquals("Connection count is not expected", halfConnections,
        networkClient.warmUpConnections(localDataNodeIds, 50, TIME_FOR_WARM_UP_MS, new ArrayList<>()));
    Assert.assertEquals("Connection count is not expected", allConnections - halfConnections,
        networkClient.warmUpConnections(localDataNodeIds, 100, TIME_FOR_WARM_UP_MS, new ArrayList<>()));
  }
Helper function to test {@link SocketNetworkClient#warmUpConnections(List, int, long, List)}. This will build up to 100%
pre-warmed connections.
ambry-network/src/test/java/com/github/ambry/network/SocketNetworkClientTest.java