@Override
  public String connect(InetSocketAddress address, int sendBufferSize, int receiveBufferSize, PortType portType)
      throws IOException {
    connectCallCount++;
    if (state == MockSelectorState.ThrowExceptionOnConnect) {
      throw new IOException("Mock connect exception");
    }
    String hostPortString = address.getHostString() + address.getPort() + index++;
    if (state == MockSelectorState.DelayFailAlternateConnect && connectCallCount % 2 != 0) {
      // add this connection to the delayed fail fresh list. These will not be returned as failed in the very
      // next poll (when it is fresh), but the subsequent poll.
      delayedFailFreshList.add(hostPortString);
    } else {
      nextConnected.add(hostPortString);
      connectionIds.add(hostPortString);
    }
    return hostPortString;
  }
Mocks the connect by simply keeping track of the connection requests to a (host, port)
@param address The address to connect to
@param sendBufferSize not used.
@param receiveBufferSize not used.
@param portType {@PortType} which represents the type of connection to establish
@return the connection id for the connection.
ambry-network/src/test/java/com/github/ambry/network/SocketNetworkClientTest.java