'Initialize or reset all of the internal state variables for a given
connection. On disconnect or reconnect all of the state needs to
be wiped.'

def _init_connection_state(self):

    self._set_connection_state(self.CONNECTION_CLOSED)
    self.server_properties = None
    self.outbound_buffer = collections.deque([])
    self._frame_buffer = bytes()
    self._channels = dict()
    self.remaining_connection_attempts = self.params.connection_attempts
    self.bytes_sent = 0
    self.bytes_received = 0
    self.frames_sent = 0
    self.frames_received = 0
    self.heartbeat = None
    self._backpressure_multiplier = 10
    self.closing = (0, 'Not    specified')
    self._add_connection_start_callback()
    self.callbacks.add(0, spec.Connection.Close, self._on_connection_close)
    if (self._connection_attempt_timer is not None):
        self.remove_timeout(self._connection_attempt_timer)
        self._connection_attempt_timer = None
    if (self.params.blocked_connection_timeout is not None):
        if (self._blocked_conn_timer is not None):
            self.remove_timeout(self._blocked_conn_timer)
            self._blocked_conn_timer = None
        self.add_on_connection_blocked_callback(self._on_connection_blocked)
        self.add_on_connection_unblocked_callback(self._on_connection_unblocked)
