public function stop(int $timeout = self::DEFAULT_SHUTDOWN_TIMEOUT): Promise
    {
        switch ($this->state) {
            case self::STARTED:
                return new Coroutine($this->doStop($timeout));
            case self::STOPPED:
                return new Success;
            default:
                return new Failure(new \Error(
                    "Cannot stop server: currently " . self::STATES[$this->state]
                ));
        }
    }
public function stop(int $timeout = self::DEFAULT_SHUTDOWN_TIMEOUT): Promise
    {
        switch ($this->state) {
            case self::STARTED:
                return new Coroutine($this->doStop($timeout));
            case self::STOPPED:
                return new Success;
            default:
                return new Failure(new \Error(
                    "Cannot stop server: currently " . self::STATES[$this->state]
                ));
        }
    }
public function stop ( int $ timeout = self :: DEFAULT_SHUTDOWN_TIMEOUT ) : Promise { switch ( $ this -> state ) { case self :: STARTED : return new Coroutine ( $ this -> doStop ( $ timeout ) ) ; case self :: STOPPED : return new Success ; default : return new Failure ( new \ Error ( "Cannot stop server: currently " . self :: STATES [ $ this -> state ] ) ) ; } }
Stop the server.

@param int $timeout Number of milliseconds to allow clients to gracefully shutdown before forcefully closing.

@return Promise
Stop the server .