def METHOD_NAME(self):
    # This is a hacky workaround for the test client's fundamentally synchronous nature
    attempt = 0
    try_count = 5
    while attempt < try_count:
        try:
            while True:
                # increase to avoid races
                message = self._ws._send_queue.get(timeout=0.01)
                if isinstance(message, BaseException):
                    raise message
                self._ws._raise_on_close(message)
                if "text" in message:
                    self._on_message(message["text"])
                if "bytes" in message:
                    self._on_message(message["bytes"])
        except Empty:
            attempt += 1