

def test_ack():
    (server, session, transport, conn) = _get_test_environment()
    session.recv(proto.message(None, 'abc', 1))
    eq_(conn.pop_incoming(), 'abc')
    eq_(transport.pop_outgoing(), '3:::abc')
    eq_(transport.pop_outgoing(), '6:::1')

    def handler(msg, data):
        eq_(msg, 'abc')
        eq_(data, None)
        conn.send('yes')
    conn.send('abc', handler)
    eq_(transport.pop_outgoing(), '3:1::abc')
    transport.recv('6:::1')
    eq_(transport.pop_outgoing(), '3:::yes')
    transport.recv(proto.event(None, 'test', 1, a=10, b=20))
    eq_(transport.pop_outgoing(), proto.event(None, 'test', None, a=10, b=20))
    eq_(transport.pop_outgoing(), proto.ack(None, 1, 'test'))

dataset/ETHPy150Open mrjoes/tornadio2/tests/session_test.py test_ack/VarMisuse@23/28 `transport`->`session`