def METHOD_NAME(self):
    def stopit(conn, addr):
        raise eventlet.StopServe()
    l = eventlet.listen(('localhost', 0))
    # connect to trigger a call to stopit
    gt = eventlet.spawn(eventlet.connect, ('localhost', l.getsockname()[1]))
    eventlet.serve(l, stopit)
    gt.wait()