@Override
  public String connect(InetSocketAddress address, int sendBufferSize, int receiveBufferSize, PortType portType)
      throws IOException {
    if (state.get() == MockSelectorState.ThrowExceptionOnConnect) {
      throw new IOException("Mock connect exception");
    }
    String host = address.getHostString();
    int port = address.getPort();
    String hostPortString = host + port;
    String connId = hostPortString + index++;
    connected.add(connId);
    connIdToServer.put(connId, serverLayout.getMockServer(host, port));
    return connId;
  }
Mocks the connect by keeping track of the connection requests to a (host, port) and the mapping from the
connection id to the associated {@link MockServer}
@param address The address to connect to
@param sendBufferSize not used.
@param receiveBufferSize not used.
@param portType {@link PortType} which represents the type of connection to establish
@return the connection id for the connection.
ambry-router/src/test/java/com/github/ambry/router/MockSelector.java