def test_close_client_hbchan():
    endpoint = random_ipc_endpoint()
    server_events = zerorpc.Events(zmq.ROUTER)
    server_events.bind(endpoint)
    server = zerorpc.ChannelMultiplexer(server_events)

    client_events = zerorpc.Events(zmq.DEALER)
    client_events.connect(endpoint)
    client = zerorpc.ChannelMultiplexer(client_events, ignore_broadcast=True)

    client_channel = client.channel()
    client_hbchan = zerorpc.HeartBeatOnChannel(client_channel, freq=TIME_FACTOR * 2)
    client_hbchan.emit('openthat', None)

    event = server.recv()
    server_channel = server.channel(event)
    server_hbchan = zerorpc.HeartBeatOnChannel(server_channel, freq=TIME_FACTOR * 2)
    server_hbchan.recv()

    gevent.sleep(TIME_FACTOR * 3)
    print 'CLOSE CLIENT SOCKET!!!'
    client_hbchan.close()
    if (2, 7) < sys.version_info:
        assert_raises(zerorpc.LostRemote, server_hbchan.recv)
    else:
        with assert_raises(zerorpc.LostRemote):
            server_hbchan.recv()
    print 'SERVER LOST CLIENT :)'
    server_hbchan.close()
    server.close()
    client.close()
dataset/ETHPy150Open 0rpc/zerorpc-python/tests/test_heartbeat.py/test_close_client_hbchan/swapped operands of `<`