'Perform follow-up processing for connection setup request: flush
connection output and process input while waiting for connection-open
or connection-error.
:raises AMQPConnectionError: on connection open error'

def _process_io_for_connection_setup(self):

    if (not self._open_error_result.ready):
        self._flush_output(self._opened_result.is_ready, self._open_error_result.is_ready)
    if self._open_error_result.ready:
        try:
            exception_or_message = self._open_error_result.value.error
            if isinstance(exception_or_message, Exception):
                raise exception_or_message
            raise exceptions.AMQPConnectionError(exception_or_message)
        finally:
            self._cleanup()
    assert self._opened_result.ready
    assert (self._opened_result.value.connection is self._impl)
