'Stops listening for new connections.
Requests currently in progress may still continue after the
server is stopped.'

def stop(self):

    if self._stopped:
        return
    self._stopped = True
    for (fd, sock) in self._sockets.items():
        assert (sock.fileno() == fd)
        self._handlers.pop(fd)()
        sock.close()
