Prepares a Jetty server for communicating with consumers.
772280
public void prepareServer() {
        try {
            server = new Server(0);
            jettyHandler = new AbstractHandler() {
                public void handle(String target, Request req, HttpServletRequest request,
                                   HttpServletResponse response) throws IOException, ServletException {
                    response.setContentType("text/plain");

                    String[] operands = request.getRequestURI().split("/");

                    String name = "";
                    String command = "";
                    String value = "";

                    //operands[0] = "", request starts with a "/"

                    if (operands.length >= 2) {
                        name = operands[1];
                    }

                    if (operands.length >= 3) {
                        command = operands[2];
                    }

                    if (operands.length >= 4) {
                        value = operands[3];
                    }

                    if (command.equals("report")) { //report a number of lines written
                        response.getWriter().write(makeReport(name, value));
                    } else if (command.equals("request") && value.equals("block")) { //request a new block of work
                        response.getWriter().write(requestBlock(name));
                    } else if (command.equals("request") && value.equals("name")) { //request a new name to report with
                        response.getWriter().write(requestName());
                    } else { //non recognized response
                        response.getWriter().write("exit");
                    }

                    ((Request) request).setHandled(true);
                }
            };

            server.setHandler(jettyHandler);

            // Select any available port
            server.start();
            Connector[] connectors = server.getConnectors();
            NetworkConnector nc = (NetworkConnector) connectors[0];
            listeningPort = nc.getLocalPort();
            hostName = InetAddress.getLocalHost().getHostName();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
344294
protected void initServer(IJettyConfiguration iJettyConfiguration) throws JettyBootstrapException {
        if (server == null) {
            server = createServer(iJettyConfiguration);
            server.setConnectors(createConnectors(iJettyConfiguration, server));

            server.setHandler(handlers);

            if (iJettyConfiguration.isStopAtShutdown()) {
                createShutdownHook();
            }
        }
    }
479319
def prepare(self):
        
        super(RabbitMQRequestHandler, self).prepare()
        if self._rabbitmq_is_closed:
            self._connect_to_rabbitmq()
1220266
protected function createSwooleServer()
    {
        $server     = $this->isWebsocket ? WebsocketServer::class : HttpServer::class;
        $config     = $this->app->config;
        $host       = $config->get('swoole.server.host');
        $port       = $config->get('swoole.server.port');
        $socketType = $config->get('swoole.server.socket_type', SWOOLE_SOCK_TCP);
        $mode       = $config->get('swoole.server.mode', SWOOLE_PROCESS);

        static::$server = new $server($host, $port, $mode, $socketType);

        $options = $config->get('swoole.server.options');

        static::$server->set($options);
    }
566286
function Server(srv, opts){
  if (!(this instanceof Server)) return new Server(srv, opts);
  if ('object' == typeof srv && srv instanceof Object && !srv.listen) {
    opts = srv;
    srv = null;
  }
  opts = opts || {};
  this.nsps = {};
  this.parentNsps = new Map();
  this.path(opts.path || '/socket.io');
  this.serveClient(false !== opts.serveClient);
  this.parser = opts.parser || parser;
  this.encoder = new this.parser.Encoder();
  this.adapter(opts.adapter || Adapter);
  this.origins(opts.origins || '*:*');
  this.sockets = this.of('/');
  if (srv) this.attach(srv, opts);
}
303346
public function onReady()
    {
        \PHPDaemon\Servers\WebSocket\Pool::getInstance()->addRoute(
            '/sockjs',
            function ($client) {
                return new SimpleRoute($client, $this);
            }
        );
    }
905413
protected function prepareWebsocket()
    {
        $config = $this->container->make('config');
        $isWebsocket = $config->get('swoole_http.websocket.enabled');
        $parser = $config->get('swoole_websocket.parser');

        if ($isWebsocket) {
            $this->events = array_merge($this->events ?? [], $this->wsEvents);
            $this->isServerWebsocket = true;
            $this->setPayloadParser(new $parser);
        }
    }
27599
protected function createSwooleServer()
    {
        $server = $this->isWebsocket ? WebsocketServer::class : HttpServer::class;
        $config = $this->app->make('config');
        $host = $config->get('swoole_http.server.host');
        $port = $config->get('swoole_http.server.port');
        $socketType = $config->get('swoole_http.server.socket_type', SWOOLE_SOCK_TCP);
        $processType = $config->get('swoole.http.server.process_type', SWOOLE_PROCESS);

        static::$server = new $server($host, $port, $processType, $socketType);
    }
1226930
def create_deliveryserver(self, domainid, data):
        """"""
        return self.api_call(
            ENDPOINTS['deliveryservers']['new'],
            dict(domainid=domainid),
            body=data)
451073
public void startServer() {

    server = new Server(httpPort);
    server.setHandler(wrapHandlers());

    if (isWebSocketInClassPath()) {
      setupForWebSocket();
    }
    try {
      server.start();
      log().info("server started");

      Runtime.getRuntime().addShutdownHook(new Thread(new ShutdownRunnable()));
      
      if (useStdInShutdown) {
        // generally for use in IDE via JettyRun, Use CTRL-D in IDE console to shutdown
        BufferedReader systemIn = new BufferedReader(new InputStreamReader(System.in, "UTF-8"));
        while((systemIn.readLine()) != null) {
          // ignore anything except CTRL-D by itself
        }
        System.out.println("Shutdown via CTRL-D");
        System.exit(0);
      }

    } catch (Exception e) {
      e.printStackTrace();
      System.exit(100);
    }
  }
31053
def prepare(self, context):
		
		
		if __debug__:
			log.debug("Preparing request context.", extra=dict(request=id(context)))
		
		# Bridge in WebOb `Request` and `Response` objects.
		# Extensions shouldn't rely on these, using `environ` where possible instead.
		context.request = Request(context.environ)
		context.response = Response(request=context.request)
		
		# Record the initial path representing the point where a front-end web server bridged to us.
		context.environ['web.base'] = context.request.script_name
		
		# Track the remaining (unprocessed) path elements.
		context.request.remainder = context.request.path_info.split('/')
		if context.request.remainder and not context.request.remainder[0]:
			del context.request.remainder[0]
		
		# Track the "breadcrumb list" of dispatch through distinct controllers.
		context.path = Bread()
1081029
def prepare_service(args=None):
    """"""
    options.register_opts(cfg.CONF)
    services.load_service_opts(cfg.CONF)
    _configure(args)
    _setup_logging()

    cfg.CONF.log_opt_values(logging.getLogger(), logging.DEBUG)
1235879
def prepare_mongod_server(server):
    
    log_info("Preparing server '%s' for use as configured..." %
             server.id)

    cluster = server.get_cluster()
    # setup the local users if server supports that
    if server.supports_local_users():
        users.setup_server_local_users(server)

    if not server.is_cluster_member() or server.is_standalone_config_server():
        users.setup_server_users(server)

    if cluster and server.is_primary():
        users.setup_cluster_users(cluster, server)
1178973
def make_server(host, port, app=None, threaded=False, processes=1,
                request_handler=None, passthrough_errors=False,
                ssl_context=None):
    
    if threaded and processes > 1:
        raise ValueError("cannot have a multithreaded and "
                         "multi process server.")
    elif threaded:
        return ThreadedWSGIServer(host, port, app, request_handler,
                                  passthrough_errors, ssl_context)
    elif processes > 1:
        return ForkingWSGIServer(host, port, app, processes, request_handler,
                                 passthrough_errors, ssl_context)
    else:
        return BaseWSGIServer(host, port, app, request_handler,
                              passthrough_errors, ssl_context)
1191400
def __make_server(self):
        ""
        notice('Making server, getting listening socket', self.color)
        self.mode = 's'
        sock = utils.get_server_sock()
        self.__s = sock
        with self.__client_list_lock:
            self.clients = deque()
        self.threads = deque()
        notice('Making beacon', self.color)
        b = Thread(target=self.__beacon_thread, name='beacon')
        b.start()
        self.threads.append(b)
        l = Thread(target=self.__listen_thread, name='listen')
        notice('Starting listen thread', self.color)
        l.start()
        self.threads.append(l)
135092
def prepare(self):
        
        self._interrupt = None

        if self.software is None:
            self.software = '%s Server' % self.version

        # Select the appropriate socket
        self.socket = None
        msg = 'No socket could be created'
        if os.getenv('LISTEN_PID', None):
            # systemd socket activation
            self.socket = socket.fromfd(3, socket.AF_INET, socket.SOCK_STREAM)
        elif isinstance(self.bind_addr, six.string_types):
            # AF_UNIX socket
            try:
                self.bind_unix_socket(self.bind_addr)
            except socket.error as serr:
                msg = '%s -- (%s: %s)' % (msg, self.bind_addr, serr)
                six.raise_from(socket.error(msg), serr)
        else:
            # AF_INET or AF_INET6 socket
            # Get the correct address family for our host (allows IPv6
            # addresses)
            host, port = self.bind_addr
            try:
                info = socket.getaddrinfo(
                    host, port, socket.AF_UNSPEC,
                    socket.SOCK_STREAM, 0, socket.AI_PASSIVE,
                )
            except socket.gaierror:
                sock_type = socket.AF_INET
                bind_addr = self.bind_addr

                if ':' in host:
                    sock_type = socket.AF_INET6
                    bind_addr = bind_addr + (0, 0)

                info = [(sock_type, socket.SOCK_STREAM, 0, '', bind_addr)]

            for res in info:
                af, socktype, proto, canonname, sa = res
                try:
                    self.bind(af, socktype, proto)
                    break
                except socket.error as serr:
                    msg = '%s -- (%s: %s)' % (msg, sa, serr)
                    if self.socket:
                        self.socket.close()
                    self.socket = None

        if not self.socket:
            raise socket.error(msg)

        # Timeout so KeyboardInterrupt can be caught on Win32
        self.socket.settimeout(1)
        self.socket.listen(self.request_queue_size)

        # Create worker threads
        self.requests.start()

        self.ready = True
        self._start_time = time.time()
25735
public void postDeploy() throws Throwable
   {
      if (server != null &&
          !server.isRunning() &&
          handlers != null && handlers.getHandlers() != null && handlers.getHandlers().length > 0)
      {
         try
         {
            ContextHandlerCollection chc = new ContextHandlerCollection();
            chc.setHandlers(handlers.getHandlers());

            server.setHandler(chc);
      
            server.start();
         }
         catch (Exception e)
         {
            log.error("Could not start Jetty webserver", e);
         }
      }
   }