def startSSL(self, ssl_options={}):
        """
        Enable SSL on the channel.

        Enabling SSL on a server channel will cause any new connections
        accepted by the server to be automatically wrapped in an SSL
        context before being passed to
        :meth:`~pants.server.Server.on_accept`. If an error occurs while
        a new connection is being wrapped,
        :meth:`~pants.server.Server.on_ssl_wrap_error` is called.

        SSL is enabled immediately. Typically, this method is called
        before :meth:`~pants.server.Server.listen`. If it is called
        afterwards, any connections made in the meantime will not have
        been wrapped in SSL contexts.

        The SSL options argument will be passed through to each
        invocation of :func:`ssl.wrap_socket` as keyword arguments - see
        the :mod:`ssl` documentation for further information. You will
        typically want to provide the ``keyfile``, ``certfile`` and
        ``ca_certs`` options. The ``do_handshake_on_connect`` option
        **must** be ``False`` and the ``server_side`` option **must** be
        true, or a :exc:`ValueError` will be raised.

        Attempting to enable SSL on a closed channel or a channel that
        already has SSL enabled on it will raise a :exc:`RuntimeError`.

        Returns the channel.

        ============ ===================================================
        Arguments    Description
        ============ ===================================================
        ssl_options  *Optional.* Keyword arguments to pass to
                     :func:`ssl.wrap_socket`.
        ============ ===================================================
        """
        if self.ssl_enabled:
            raise RuntimeError("startSSL() called on SSL-enabled %r." % self)

        if self._closed:
            raise RuntimeError("startSSL() called on closed %r." % self)

        if ssl_options.setdefault("server_side", True) is not True:
            raise ValueError("SSL option 'server_side' must be True.")

        if ssl_options.setdefault("do_handshake_on_connect", False) is not False:
            raise ValueError("SSL option 'do_handshake_on_connect' must be False.")

        self.ssl_enabled = True
        self._ssl_options = ssl_options

        return self
dataset/ETHPy150Open ecdavis/pants/pants/server.py/Server.startSSL/original