'Terminate the connection and notify registered ON_CONNECTION_ERROR
and/or ON_CONNECTION_CLOSED callbacks
:param integer reason_code: either IETF RFC 821 reply code for
AMQP-level closures or a value from `InternalCloseReasons` for
internal causes, such as socket errors
:param str reason_text: human-readable text message describing the error'

def _on_terminate(self, reason_code, reason_text):

    LOGGER.info('Disconnected    from    RabbitMQ    at    %s:%i    (%s):    %s', self.params.host, self.params.port, reason_code, reason_text)
    if (not isinstance(reason_code, numbers.Integral)):
        raise TypeError(('reason_code    must    be    an    integer,    but    got    %r' % (reason_code,)))
    self._remove_heartbeat()
    self._remove_callbacks(0, [spec.Connection.Close, spec.Connection.Start, spec.Connection.Open])
    if (self.params.blocked_connection_timeout is not None):
        self._remove_callbacks(0, [spec.Connection.Blocked, spec.Connection.Unblocked])
    self._adapter_disconnect()
    connection_error = None
    if (self.connection_state == self.CONNECTION_PROTOCOL):
        LOGGER.error('Incompatible    Protocol    Versions')
        connection_error = exceptions.IncompatibleProtocolError(reason_code, reason_text)
    elif (self.connection_state == self.CONNECTION_START):
        LOGGER.error('Connection    closed    while    authenticating    indicating    a    probable    authentication    error')
        connection_error = exceptions.ProbableAuthenticationError(reason_code, reason_text)
    elif (self.connection_state == self.CONNECTION_TUNE):
        LOGGER.error('Connection    closed    while    tuning    the    connection    indicating    a    probable    permission    error    when    accessing    a    virtual    host')
        connection_error = exceptions.ProbableAccessDeniedError(reason_code, reason_text)
    elif (self.connection_state not in [self.CONNECTION_OPEN, self.CONNECTION_CLOSED, self.CONNECTION_CLOSING]):
        LOGGER.warning('Unexpected    connection    state    on    disconnect:    %i', self.connection_state)
    self._set_connection_state(self.CONNECTION_CLOSED)
    for channel in dictkeys(self._channels):
        if (channel not in self._channels):
            continue
        self._channels[channel]._on_close_meta(reason_code, reason_text)
    if (connection_error is not None):
        LOGGER.error('Connection    setup    failed    due    to    %r', connection_error)
        self.callbacks.process(0, self.ON_CONNECTION_ERROR, self, self, connection_error)
    self.callbacks.process(0, self.ON_CONNECTION_CLOSED, self, self, reason_code, reason_text)
    self._init_connection_state()
