code: protected final short addNewConnection () throws Exception {
  
          if (connections.size() < maxConnections) {
  
              final Connection connection = factory.getConnection(this, configuration, inetSocketAddress, nextFreeConnectionID);
              connection.nextState(new LoginRequestState(connection, LoginStage.FULL_FEATURE_PHASE));
              // login phase successful, so we can add a new connection
              connections.add(connection);
  
              // only needed on the leading login connection
              if (connections.size() == 1) {
                  phase.getCapacity(this, capacityInformations);
  
                  if (connection.getSettingAsInt(OperationalTextKey.MAX_CONNECTIONS) > 1) {
                      phase.login(this);
                  }
              }
  
              return nextFreeConnectionID++;
          } else {
              LOGGER.warn("Unused new connection -> ignored!");
              return nextFreeConnectionID;
          }
  
      }
docs: Adds a new connection to this session with the next free connection ID (if the maximum number is not reached).
  
  @return The connection ID of the newly created connection.
  @throws Exception if any error occurs.