bool ApplicationEndpointServer::parsePhase2 (ProgramOptions& options) {
  // create the ssl context (if possible)
  bool ok = createSslContext();

  if (! ok) {
    return false;
  }

  if (_backlogSize <= 0 || _backlogSize > SOMAXCONN) {
    LOGGER_FATAL_AND_EXIT("invalid value for --server.backlog-size. maximum allowed value is " << SOMAXCONN);
  }

  if (_httpPort != "") {
    // issue #175: add hidden option --server.http-port for downwards-compatibility
    string httpEndpoint("tcp://" + _httpPort);
    _endpoints.push_back(httpEndpoint);
  }

  OperationMode::server_operation_mode_e mode = OperationMode::determineMode(options);
  if (_endpoints.empty() && mode == OperationMode::MODE_SERVER) {
    LOGGER_INFO("please use the '--server.endpoint' option");
    LOGGER_FATAL_AND_EXIT("no endpoint has been specified, giving up");
  }
  
  // add & validate endpoints
  for (vector<string>::const_iterator i = _endpoints.begin(); i != _endpoints.end(); ++i) {
    Endpoint* endpoint = Endpoint::serverFactory(*i, _backlogSize);
  
    if (endpoint == 0) {
      LOGGER_FATAL_AND_EXIT("invalid endpoint '" << *i << "'");
    }

    assert(endpoint);

    bool ok = _endpointList.addEndpoint(endpoint->getProtocol(), endpoint->getEncryption(), endpoint);
    if (! ok) {
      LOGGER_FATAL_AND_EXIT("invalid endpoint '" << *i << "'");
    }
  }

  // dump used endpoints for user information
  _endpointList.dump();

  // and return
  return true;
}