'Connection initialization expects an object that has implemented the
Parameters class and a callback function to notify when we have
successfully connected to the AMQP Broker.
Available Parameters classes are the ConnectionParameters class and
URLParameters class.
:param pika.connection.Parameters parameters: Connection parameters
:param method on_open_callback: Called when the connection is opened
:param method on_open_error_callback: Called if the connection can\'t
be established: on_open_error_callback(connection, str|exception)
:param method on_close_callback: Called when the connection is closed:
`on_close_callback(connection, reason_code, reason_text)`, where
`reason_code` is either an IETF RFC 821 reply code for AMQP-level
closures or a value from `pika.connection.InternalCloseReasons` for
internal causes, such as socket errors.'

def __init__(self, parameters=None, on_open_callback=None, on_open_error_callback=None, on_close_callback=None):

    self.connection_state = self.CONNECTION_CLOSED
    self._connection_attempt_timer = None
    self._blocked_conn_timer = None
    self.heartbeat = None
    self.params = (copy.deepcopy(parameters) if (parameters is not None) else ConnectionParameters())
    self.callbacks = callback.CallbackManager()
    self.server_capabilities = None
    self.server_properties = None
    self._body_max_length = None
    self.known_hosts = None
    self.closing = None
    self._frame_buffer = None
    self._channels = None
    self._backpressure_multiplier = None
    self.remaining_connection_attempts = None
    self._init_connection_state()
    self.callbacks.add(0, self.ON_CONNECTION_ERROR, (on_open_error_callback or self._on_connection_error), False)
    if on_open_callback:
        self.add_on_open_callback(on_open_callback)
    if on_close_callback:
        self.add_on_close_callback(on_close_callback)
    self.connect()
