summaryrefslogtreecommitdiff
path: root/tests/twisted/connect/ping.py
blob: 7a5b8e07e4292609a89861081a1d61ff1451382b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"""
Test Idle sending PINGs.
"""

from idletest import exec_test
from servicetest import EventPattern, call_async

def test(q, bus, conn, stream):
    conn.Connect()
    q.expect('dbus-signal', signal='StatusChanged', args=[0, 1])

    e = q.expect('stream-PING')
    timestamp = e.data[0]
    stream.sendMessage('PONG', timestamp)

if __name__ == '__main__':
    exec_test(test, params={
        'keepalive-interval': 1,
    })