MCPcopy Create free account
hub / github.com/apache/qpid-proton / testKeepalive

Method testKeepalive

python/tests/proton_tests/engine.py:2146–2174  ·  view source on GitHub ↗

Verify that idle frames are sent to keep a Connection alive

(self)

Source from the content-addressed store, hash-verified

2144class ServerTest(Test):
2145
2146 def testKeepalive(self):
2147 """ Verify that idle frames are sent to keep a Connection alive
2148 """
2149 idle_timeout = self.delay
2150 server = common.TestServer()
2151 server.start()
2152
2153 class Program:
2154
2155 def on_reactor_init(self, event):
2156 self.conn = event.reactor.connection()
2157 self.conn.hostname = "%s:%s" % (server.host, server.port)
2158 self.conn.open()
2159 self.old_count = None
2160 event.reactor.schedule(3 * idle_timeout, self)
2161
2162 def on_connection_bound(self, event):
2163 event.transport.idle_timeout = idle_timeout
2164
2165 def on_connection_remote_open(self, event):
2166 self.old_count = event.transport.frames_input
2167
2168 def on_timer_task(self, event):
2169 assert self.conn.state == (Endpoint.LOCAL_ACTIVE | Endpoint.REMOTE_ACTIVE), "Connection terminated"
2170 assert self.conn.transport.frames_input > self.old_count, "No idle frames received"
2171 self.conn.close()
2172
2173 Container(Program()).run()
2174 server.stop()
2175
2176 def testIdleTimeout(self):
2177 """ Verify that a Connection is terminated properly when Idle frames do not

Callers

nothing calls this directly

Calls 5

startMethod · 0.95
stopMethod · 0.95
ContainerClass · 0.90
ProgramClass · 0.70
runMethod · 0.45

Tested by

no test coverage detected