Repository: pika/pika

Issue:
Rename add_timeout(self, deadline, callback) to call_later(self, delay, callback)
See [this comment](https://github.com/pika/pika/pull/1045#discussion_r188309728) from @vitaly-krugl 

Discussion:

Patch:
diff --git a/docs/version_history.rst b/docs/version_history.rst
index 317b2c1..ae19d64 100644
--- a/docs/version_history.rst
+++ b/docs/version_history.rst
@@ -10,10 +10,14 @@ Version History
 - ``BlockingConnection.consume`` now returns ``(None, None, None)`` when inactivity timeout is reached (`PR <https://github.com/pika/pika/pull/899>`_)
 - Python 3.7 support (`Issue <https://github.com/pika/pika/issues/1107>`_)
 - ``all_channels`` parameter of the ``Channel.basic_qos`` method renamed to ``global_qos``
+- ``global_`` parameter of the ``Basic.Qos`` spec class renamed to ``global_qos``
 - **NOTE:** ``heartbeat_interval`` is removed, use ``heartbeat`` instead.
 - **NOTE:** The `backpressure_detection` option of `ConnectionParameters` and `URLParameters` property is REMOVED in favor of `Connection.Blocked` and `Connection.Unblocked`. See `Connection.add_on_connection_blocked_callback`.
 - **NOTE:** The legacy ``basic_publish`` method is removed, and ``publish`` renamed to ``basic_publish``
 - **NOTE**: The signature of the following methods has changed from Pika 0.13.0. In general, the callback parameter that indicates completion of the method has been moved to the end of the parameter list to be consistent with other parts of Pika's API and with other libraries in general.
+
+**IMPORTANT**: The signature of the following methods has changed from Pika 0.13.0. In general, the callback parameter that indicates completion of the method has been moved to the end of the parameter list to be consistent with other parts of Pika's API and with other libraries in general.
+
 - ``basic_cancel``
 - ``basic_consume``
 - ``basic_get``
@@ -31,6 +35,8 @@ Version History
 - ``queue_purge``
 - ``queue_unbind``
 
+**IMPORTANT**: When specifying TLS / SSL options, the ``SSLOptions`` class must be used, and a ``dict`` is no longer supported.
+
 0.12.0 2018-06-19
 -----------------
 
diff --git a/examples/consumer_simple.py b/examples/consumer_simple.py
index 8d9c00f..a987134 100644
--- a/examples/consumer_simple.py
+++ b/examples/consumer_simple.py
@@ -27,7 +27,7 @@ def hello():
     print('Hello world')
 
 
-connection.add_timeout(5, hello)
+connection.call_later(5, hello)
 
 
 def callback(ch, method, properties, body):
diff --git a/examples/send.py b/examples/send.py
index 57098f8..3984972 100644
--- a/examples/send.py
+++ b/examples/send.py
@@ -13,7 +13,7 @@ def closeit():
     print('Close it')
     connection.close()
 
-connection.add_timeout(5, closeit)
+connection.call_later(5, closeit)
 
 connection.sleep(100)
 
diff --git a/pika/adapters/base_connection.py b/pika/adapters/base_connection.py
index da8667e..b925235 100644
--- a/pika/adapters/base_connection.py
+++ b/pika/adapters/base_connection.py
@@ -198,12 +198,12 @@ class BaseConnection(connection.Connection):
         """
         return self._nbio.get_native_ioloop()
 
-    def _adapter_add_timeout(self, deadline, callback):
+    def _adapter_call_later(self, delay, callback):
         """Implement
-        :py:meth:`pika.connection.Connection._adapter_add_timeout()`.
+        :py:meth:`pika.connection.Connection._adapter_call_later()`.
 
         """
-        return self._nbio.call_later(deadline, callback)
+        return self._nbio.call_later(delay, callback)
 
     def _adapter_remove_timeout(self, timeout_id):
         """Implement
diff --git a/pika/adapters/blocking_connection.py b/pika/adapters/blocking_connection.py
index 0684bed..4a7e103 100644
--- a/pika/adapters/blocking_connection.py
+++ b/pika/adapters/blocking_connection.py
@@ -176,7 +176,7 @@ class _IoloopTimerContext(object):
         :param float duration: non-negative timer duration in seconds
         :param select_connection.SelectConnection connection:
         """
-        assert hasattr(connection, '_adapter_add_timeout'), connection
+        assert hasattr(connection, '_adapter_call_later'), connection
         self._duration = duration
         self._connection = connection
         self._callback_result = _CallbackResult()
@@ -184,7 +184,7 @@ class _IoloopTimerContext(object):
 
     def __enter__(self):
         """Register a timer"""
-        self._timer_handle = self._connection._adapter_add_timeout(
+        self._timer_handle = self._connection._adapter_call_later(
             self._duration, self._callback_result.signal_once)
         return self
 
@@ -202,17 +202,17 @@ class _IoloopTimerContext(object):
 
 
 class _TimerEvt(object):
-    """Represents a timer created via `BlockingConnection.add_timeout`"""
+    """Represents a timer created via `BlockingConnection.call_later`"""
     __slots__ = ('timer_id', '_callback')
 
     def __init__(self, callback):
         """
-        :param callback: see callback in `BlockingConnection.add_timeout`
+        :param callback: see callback in `BlockingConnection.call_later`
         """
         self._callback = callback
 
         # Will be set to timer id returned from the underlying implementation's
-        # `_adapter_add_timeout` method
+        # `_adapter_call_later` method
         self.timer_id = None
 
     def __repr__(self):
@@ -279,7 +279,7 @@ class BlockingConnection(object):
     in nested context (e.g., while waiting for `BlockingConnection.channel` or
     `BlockingChannel.queue_declare` to complete), dispatching them synchronously
     once nesting returns to the desired context. This concerns all callbacks,
-    such as those registered via `BlockingConnection.add_timeout`,
+    such as those registered via `BlockingConnection.call_later`,
     `BlockingConnection.add_on_connection_blocked_callback`,
     `BlockingConnection.add_on_connection_unblocked_callback`,
     `BlockingChannel.basic_consume`, etc.
@@ -564,7 +564,7 @@ class BlockingConnection(object):
 
     def _on_timer_ready(self, evt):
         """Handle expiry of a timer that was registered via
-        `_adapter_add_timeout()`
+        `_adapter_call_later()`
 
         :param _TimerEvt evt:
 
@@ -581,7 +581,7 @@ class BlockingConnection(object):
         """
         # Turn it into a 0-delay timeout to take advantage of our existing logic
         # that deals with reentrancy
-        self.add_timeout(0, user_callback)
+        self.call_later(0, user_callback)
 
     def _on_connection_blocked(self, user_callback, _impl, method_frame):
         """Handle Connection.Blocked notification from RabbitMQ broker
@@ -673,8 +673,8 @@ class BlockingConnection(object):
             functools.partial(self._on_connection_unblocked,
                               functools.partial(callback, self)))
 
-    def add_timeout(self, deadline, callback):
-        """Create a single-shot timer to fire after deadline seconds. Do not
+    def call_later(self, delay, callback):
+        """Create a single-shot timer to fire after delay seconds. Do not
         confuse with Tornado's timeout where you pass in the time you want to
         have your callback called. Only pass in the seconds until it's to be
         called.
@@ -684,7 +684,7 @@ class BlockingConnection(object):
         `BlockingConnection.process_data_events()` and
         `BlockingChannel.start_consuming()`.
 
-        :param float deadline: The number of seconds to wait to call callback
+        :param float delay: The number of seconds to wait to call callback
         :param callable callback: The callback method with the signature
             callback()
 
@@ -694,8 +694,8 @@ class BlockingConnection(object):
         validators.require_callback(callback)
 
         evt = _TimerEvt(callback=callback)
-        timer_id = self._impl._adapter_add_timeout(
-            deadline, functools.partial(self._on_timer_ready, evt))
+        timer_id = self._impl._adapter_call_later(
+            delay, functools.partial(self._on_timer_ready, evt))
         evt.timer_id = timer_id
 
         return timer_id
@@ -724,7 +724,7 @@ class BlockingConnection(object):
 
         NOTE: if you know that the requester is running on the same thread as
         the connection it is more efficient to use the
-        `BlockingConnection.add_timeout()` method with a deadline of 0.
+        `BlockingConnection.call_later()` method with a delay of 0.
 
         :param method callback: The callback method; must be callable
 
diff --git a/pika/adapters/twisted_connection.py b/pika/adapters/twisted_connection.py
index 8f43de7..583fa58 100644
--- a/pika/adapters/twisted_connection.py
+++ b/pika/adapters/twisted_connection.py
@@ -1084,13 +1084,13 @@ class _TwistedConnectionAdapter(pika.connection.Connection):
         self._reactor = custom_reactor or reactor
         self._transport = None  # to be provided by `connection_made()`
 
-    def _adapter_add_timeout(self, deadline, callback):
+    def _adapter_call_later(self, delay, callback):
         """Implement
-        :py:meth:`pika.connection.Connection._adapter_add_timeout()`.
+        :py:meth:`pika.connection.Connection._adapter_call_later()`.
 
         """
         check_callback_arg(callback, 'callback')
-        return _TimerHandle(self._reactor.callLater(deadline, callback))
+        return _TimerHandle(self._reactor.callLater(delay, callback))
 
     def _adapter_remove_timeout(self, timeout_id):
         """Implement
diff --git a/pika/connection.py b/pika/connection.py
index e94385a..6945099 100644
--- a/pika/connection.py
+++ b/pika/connection.py
@@ -1385,12 +1385,12 @@ class Connection(pika.compat.AbstractBase):
         return self.server_capabilities.get('publisher_confirms', False)
 
     @abc.abstractmethod
-    def _adapter_add_timeout(self, deadline, callback):
+    def _adapter_call_later(self, delay, callback):
         """Adapters should override to call the callback after the
         specified number of seconds have elapsed, using a timer, or a
         thread, or similar.
 
-        :param float | int deadline: The number of seconds to wait to call
+        :param float | int delay: The number of seconds to wait to call
             callback
         :param method callback: The callback will be called without args.
         :return: Handle that can be passed to `_adapter_remove_timeout()` to
@@ -1740,7 +1740,7 @@ class Connection(pika.compat.AbstractBase):
                            '_on_connection_blocked is called',
                            self._blocked_conn_timer)
         else:
-            self._blocked_conn_timer = self._adapter_add_timeout(
+            self._blocked_conn_timer = self._adapter_call_later(
                 self.params.blocked_connection_timeout,
                 self._on_blocked_connection_timeout)
 
diff --git a/pika/heartbeat.py b/pika/heartbeat.py
index 9580069..19a243a 100644
--- a/pika/heartbeat.py
+++ b/pika/heartbeat.py
@@ -187,7 +187,7 @@ class HeartbeatChecker(object):
 
     def _start_send_timer(self):
         """Start a new heartbeat send timer."""
-        self._send_timer = self._connection._adapter_add_timeout(  # pylint: disable=W0212
+        self._send_timer = self._connection._adapter_call_later(  # pylint: disable=W0212
             self._send_interval,
             self._send_heartbeat)
 
@@ -199,7 +199,7 @@ class HeartbeatChecker(object):
         # end of the window
         self._update_counters()
 
-        self._check_timer = self._connection._adapter_add_timeout(  # pylint: disable=W0212
+        self._check_timer = self._connection._adapter_call_later(  # pylint: disable=W0212
             self._check_interval,
             self._check_heartbeat)
 


Test patch:
diff --git a/tests/acceptance/async_adapter_tests.py b/tests/acceptance/async_adapter_tests.py
index b87ff3b..014aa4b 100644
--- a/tests/acceptance/async_adapter_tests.py
+++ b/tests/acceptance/async_adapter_tests.py
@@ -982,7 +982,7 @@ class TestBlockedConnectionUnblocks(AsyncTestCase, AsyncAdapters):  # pylint: di
             pika.frame.Method(0, spec.Connection.Unblocked()))
 
         # Schedule shutdown after blocked connection timeout would expire
-        channel.connection._adapter_add_timeout(0.005, self.on_cleanup_timer)
+        channel.connection._adapter_call_later(0.005, self.on_cleanup_timer)
 
     def on_cleanup_timer(self):
         self.stop()
@@ -1112,8 +1112,8 @@ class TestViabilityOfMultipleTimeoutsWithSameDeadlineAndCallback(AsyncTestCase,
     DESCRIPTION = "Test viability of multiple timeouts with same deadline and callback"
 
     def begin(self, channel):
-        timer1 = channel.connection._adapter_add_timeout(0, self.on_my_timer)
-        timer2 = channel.connection._adapter_add_timeout(0, self.on_my_timer)
+        timer1 = channel.connection._adapter_call_later(0, self.on_my_timer)
+        timer2 = channel.connection._adapter_call_later(0, self.on_my_timer)
 
         self.assertIsNot(timer1, timer2)
 
diff --git a/tests/acceptance/async_test_base.py b/tests/acceptance/async_test_base.py
index 8d9919d..0eff7de 100644
--- a/tests/acceptance/async_test_base.py
+++ b/tests/acceptance/async_test_base.py
@@ -164,8 +164,8 @@ class AsyncTestCase(unittest.TestCase):
                                        self.on_closed,
                                        custom_ioloop=ioloop_factory())
         try:
-            self.timeout = self.connection._adapter_add_timeout(self.TIMEOUT,
-                                                                self.on_timeout)
+            self.timeout = self.connection._adapter_call_later(self.TIMEOUT,
+                                                               self.on_timeout)
             self._run_ioloop()
 
             self.assertFalse(self._timed_out)
diff --git a/tests/acceptance/blocking_adapter_test.py b/tests/acceptance/blocking_adapter_test.py
index 20607bd..22b63d2 100644
--- a/tests/acceptance/blocking_adapter_test.py
+++ b/tests/acceptance/blocking_adapter_test.py
@@ -75,7 +75,7 @@ class BlockingTestCaseBase(unittest.TestCase):
 
         # We use impl's timer directly in order to get a callback regardless
         # of BlockingConnection's event dispatch modality
-        connection._impl._adapter_add_timeout(self.TIMEOUT, # pylint: disable=E1101
+        connection._impl._adapter_call_later(self.TIMEOUT, # pylint: disable=E1101
                                               self._on_test_timeout)
 
         # Patch calls into I/O loop to fail test if exceptions are
@@ -651,13 +651,13 @@ class TestAddCallbackThreadsafeOnClosedConnectionRaisesWrongState(
 class TestAddTimeoutRemoveTimeout(BlockingTestCaseBase):
 
     def test(self):
-        """BlockingConnection.add_timeout and remove_timeout"""
+        """BlockingConnection.call_later and remove_timeout"""
         connection = self._connect()
 
         # Test timer completion
         start_time = time.time()
         rx_callback = []
-        timer_id = connection.add_timeout(
+        timer_id = connection.call_later(
             0.005,
             lambda: rx_callback.append(time.time()))
         while not rx_callback:
@@ -673,7 +673,7 @@ class TestAddTimeoutRemoveTimeout(BlockingTestCaseBase):
 
         # Test aborted timer
         rx_callback = []
-        timer_id = connection.add_timeout(
+        timer_id = connection.call_later(
             0.001,
             lambda: rx_callback.append(time.time()))
         connection.remove_timeout(timer_id)
@@ -696,8 +696,8 @@ class TestViabilityOfMultipleTimeoutsWithSameDeadlineAndCallback(BlockingTestCas
         def callback():
             rx_callback.append(1)
 
-        timer1 = connection.add_timeout(0, callback)
-        timer2 = connection.add_timeout(0, callback)
+        timer1 = connection.call_later(0, callback)
+        timer2 = connection.call_later(0, callback)
 
         self.assertIsNot(timer1, timer2)
 
@@ -718,7 +718,7 @@ class TestRemoveTimeoutFromTimeoutCallback(BlockingTestCaseBase):
         connection = self._connect()
 
         # Test timer completion
-        timer_id1 = connection.add_timeout(5, lambda: 0/0)
+        timer_id1 = connection.call_later(5, lambda: 0/0)
 
         rx_timer2 = []
         def on_timer2():
@@ -726,7 +726,7 @@ class TestRemoveTimeoutFromTimeoutCallback(BlockingTestCaseBase):
             connection.remove_timeout(timer_id2)
             rx_timer2.append(1)
 
-        timer_id2 = connection.add_timeout(0, on_timer2)
+        timer_id2 = connection.call_later(0, on_timer2)
 
         while not rx_timer2:
             connection.process_data_events(time_limit=None)
diff --git a/tests/acceptance/twisted_adapter_tests.py b/tests/acceptance/twisted_adapter_tests.py
index 3572e33..5651a19 100644
--- a/tests/acceptance/twisted_adapter_tests.py
+++ b/tests/acceptance/twisted_adapter_tests.py
@@ -800,7 +800,7 @@ class TwistedConnectionAdapterTestCase(TestCase):
     def test_timeout(self):
         # Verify that timeouts are registered and cancelled properly.
         callback = mock.Mock()
-        timer_id = self.conn._adapter_add_timeout(5, callback)
+        timer_id = self.conn._adapter_call_later(5, callback)
         self.assertEqual(len(reactor.getDelayedCalls()), 1)
         self.conn._adapter_remove_timeout(timer_id)
         self.assertEqual(len(reactor.getDelayedCalls()), 0)
diff --git a/tests/unit/channel_tests.py b/tests/unit/channel_tests.py
index aea2f17..53cc5da 100644
--- a/tests/unit/channel_tests.py
+++ b/tests/unit/channel_tests.py
@@ -30,7 +30,7 @@ class ConnectionTemplate(connection.Connection):
     _adapter_connect_stream = connection.Connection._adapter_connect_stream
     _adapter_disconnect_stream = connection.Connection._adapter_disconnect_stream
     _adapter_emit_data = connection.Connection._adapter_emit_data
-    _adapter_add_timeout = connection.Connection._adapter_add_timeout
+    _adapter_call_later = connection.Connection._adapter_call_later
     _adapter_remove_timeout = connection.Connection._adapter_remove_timeout
     _adapter_add_callback_threadsafe = (
         connection.Connection._adapter_add_callback_threadsafe)
diff --git a/tests/unit/connection_tests.py b/tests/unit/connection_tests.py
index 13a0ba0..74e70d0 100644
--- a/tests/unit/connection_tests.py
+++ b/tests/unit/connection_tests.py
@@ -44,7 +44,7 @@ class ConstructibleConnection(connection.Connection):
     def _adapter_disconnect_stream(self):
         raise NotImplementedError
 
-    def _adapter_add_timeout(self, deadline, callback):
+    def _adapter_call_later(self, delay, callback):
         raise NotImplementedError
 
     def _adapter_remove_timeout(self, timeout_id):
@@ -731,13 +731,13 @@ class ConnectionTests(unittest.TestCase):  # pylint: disable=R0904
         conn.add_on_connection_unblocked_callback.assert_called_once_with(
             conn._on_connection_unblocked)
 
-    @mock.patch.object(ConstructibleConnection, '_adapter_add_timeout')
+    @mock.patch.object(ConstructibleConnection, '_adapter_call_later')
     @mock.patch.object(
         connection.Connection,
         '_adapter_connect_stream',
         spec_set=connection.Connection._adapter_connect_stream)
     def test_connection_blocked_sets_timer(self, connect_mock,
-                                           add_timeout_mock):
+                                           call_later_mock):
         with mock.patch.object(ConstructibleConnection,
                                '_adapter_connect_stream'):
             conn = ConstructibleConnection(
@@ -749,18 +749,18 @@ class ConnectionTests(unittest.TestCase):  # pylint: disable=R0904
             mock.Mock(name='frame.Method(Connection.Blocked)'))
 
         # Check
-        conn._adapter_add_timeout.assert_called_once_with(
+        conn._adapter_call_later.assert_called_once_with(
             60, conn._on_blocked_connection_timeout)
 
         self.assertIsNotNone(conn._blocked_conn_timer)
 
-    @mock.patch.object(ConstructibleConnection, '_adapter_add_timeout')
+    @mock.patch.object(ConstructibleConnection, '_adapter_call_later')
     @mock.patch.object(
         connection.Connection,
         '_adapter_connect_stream',
         spec_set=connection.Connection._adapter_connect_stream)
     def test_blocked_connection_multiple_blocked_in_a_row_sets_timer_once(
-            self, connect_mock, add_timeout_mock):
+            self, connect_mock, call_later_mock):
 
         with mock.patch.object(ConstructibleConnection,
                                '_adapter_connect_stream'):
@@ -774,7 +774,7 @@ class ConnectionTests(unittest.TestCase):  # pylint: disable=R0904
             mock.Mock(name='frame.Method(Connection.Blocked)'))
 
         # Check
-        conn._adapter_add_timeout.assert_called_once_with(
+        conn._adapter_call_later.assert_called_once_with(
             60, conn._on_blocked_connection_timeout)
 
         self.assertIsNotNone(conn._blocked_conn_timer)
@@ -786,20 +786,20 @@ class ConnectionTests(unittest.TestCase):  # pylint: disable=R0904
             conn,
             mock.Mock(name='frame.Method(Connection.Blocked)'))
 
-        self.assertEqual(conn._adapter_add_timeout.call_count, 1)
+        self.assertEqual(conn._adapter_call_later.call_count, 1)
         self.assertIs(conn._blocked_conn_timer, timer)
 
     @mock.patch.object(connection.Connection, '_on_stream_terminated')
     @mock.patch.object(
         ConstructibleConnection,
-        '_adapter_add_timeout',
-        spec_set=connection.Connection._adapter_add_timeout)
+        '_adapter_call_later',
+        spec_set=connection.Connection._adapter_call_later)
     @mock.patch.object(
         connection.Connection,
         '_adapter_connect_stream',
         spec_set=connection.Connection._adapter_connect_stream)
     def test_blocked_connection_timeout_terminates_connection(
-            self, connect_mock, add_timeout_mock, on_terminate_mock):
+            self, connect_mock, call_later_mock, on_terminate_mock):
 
         with mock.patch.multiple(ConstructibleConnection,
                                  _adapter_connect_stream=mock.Mock(),
@@ -827,14 +827,14 @@ class ConnectionTests(unittest.TestCase):  # pylint: disable=R0904
     @mock.patch.object(ConstructibleConnection, '_adapter_remove_timeout')
     @mock.patch.object(
         ConstructibleConnection,
-        '_adapter_add_timeout',
-        spec_set=connection.Connection._adapter_add_timeout)
+        '_adapter_call_later',
+        spec_set=connection.Connection._adapter_call_later)
     @mock.patch.object(
         connection.Connection,
         '_adapter_connect_stream',
         spec_set=connection.Connection._adapter_connect_stream)
     def test_blocked_connection_unblocked_removes_timer(
-            self, connect_mock, add_timeout_mock, remove_timeout_mock):
+            self, connect_mock, call_later_mock, remove_timeout_mock):
 
         with mock.patch.object(ConstructibleConnection,
                                '_adapter_connect_stream'):
@@ -861,14 +861,14 @@ class ConnectionTests(unittest.TestCase):  # pylint: disable=R0904
     @mock.patch.object(ConstructibleConnection, '_adapter_remove_timeout')
     @mock.patch.object(
         ConstructibleConnection,
-        '_adapter_add_timeout',
-        spec_set=connection.Connection._adapter_add_timeout)
+        '_adapter_call_later',
+        spec_set=connection.Connection._adapter_call_later)
     @mock.patch.object(
         connection.Connection,
         '_adapter_connect_stream',
         spec_set=connection.Connection._adapter_connect_stream)
     def test_blocked_connection_multiple_unblocked_in_a_row_removes_timer_once(
-            self, connect_mock, add_timeout_mock, remove_timeout_mock):
+            self, connect_mock, call_later_mock, remove_timeout_mock):
 
         with mock.patch.object(ConstructibleConnection,
                                '_adapter_connect_stream'):
@@ -905,8 +905,8 @@ class ConnectionTests(unittest.TestCase):  # pylint: disable=R0904
     @mock.patch.object(ConstructibleConnection, '_adapter_remove_timeout')
     @mock.patch.object(
         ConstructibleConnection,
-        '_adapter_add_timeout',
-        spec_set=connection.Connection._adapter_add_timeout)
+        '_adapter_call_later',
+        spec_set=connection.Connection._adapter_call_later)
     @mock.patch.object(
         connection.Connection,
         '_adapter_connect_stream',
@@ -916,7 +916,7 @@ class ConnectionTests(unittest.TestCase):  # pylint: disable=R0904
         '_adapter_disconnect_stream',
         spec_set=connection.Connection._adapter_disconnect_stream)
     def test_blocked_connection_on_stream_terminated_removes_timer(
-            self, adapter_disconnect_mock, connect_mock, add_timeout_mock,
+            self, adapter_disconnect_mock, connect_mock, call_later_mock,
             remove_timeout_mock):
 
         with mock.patch.object(ConstructibleConnection,
diff --git a/tests/unit/heartbeat_tests.py b/tests/unit/heartbeat_tests.py
index 9665eab..a708acc 100644
--- a/tests/unit/heartbeat_tests.py
+++ b/tests/unit/heartbeat_tests.py
@@ -31,7 +31,7 @@ class ConstructableConnection(connection.Connection):
     def _adapter_disconnect_stream(self):
         raise NotImplementedError
 
-    def add_timeout(self, deadline, callback):
+    def call_later(self, delay, callback):
         raise NotImplementedError
 
     def remove_timeout(self, timeout_id):
@@ -43,7 +43,7 @@ class ConstructableConnection(connection.Connection):
     def _adapter_add_callback_threadsafe(self, callback):
         raise NotImplementedError
 
-    def _adapter_add_timeout(self, deadline, callback):
+    def _adapter_call_later(self, deadline, callback):
         raise NotImplementedError
 
     def _adapter_remove_timeout(self, timeout_id):
@@ -213,7 +213,7 @@ class HeartbeatTests(unittest.TestCase):
     def test_start_send_timer_called(self):
         want = [mock.call(self.SEND_INTERVAL, self.obj._send_heartbeat),
                 mock.call(self.CHECK_INTERVAL, self.obj._check_heartbeat)]
-        got = self.mock_conn._adapter_add_timeout.call_args_list
+        got = self.mock_conn._adapter_call_later.call_args_list
         self.assertEqual(got, want)
 
     def test_update_counters_bytes_received(self):