Example #1
0
 def test_recv(self, tco, pdu):
     assert tco.enqueue(pdu) is True
     assert tco.enqueue(pdu) is False
     tco.setsockopt(nfc.llcp.SO_RCVBUF, 2)
     assert tco.enqueue(pdu) is True
     assert tco.enqueue(pdu) is False
     assert tco.recv() == pdu
     assert tco.recv() == pdu
     threading.Timer(0.01, tco.enqueue, (pdu, )).start()
     tco.recv()
Example #2
0
 def test_recv(self, tco, pdu):
     assert tco.enqueue(pdu) is True
     assert tco.enqueue(pdu) is False
     tco.setsockopt(nfc.llcp.SO_RCVBUF, 2)
     assert tco.enqueue(pdu) is True
     assert tco.enqueue(pdu) is False
     assert tco.recv() == pdu
     assert tco.recv() == pdu
     threading.Timer(0.01, tco.enqueue, (pdu,)).start()
     tco.recv()
Example #3
0
 def test_recv(self, tco):
     pdu = nfc.llcp.pdu.UnnumberedInformation(1, 1, HEX('1122'))
     assert tco.enqueue(pdu) is True
     assert tco.recv() == pdu
     threading.Timer(0.01, tco.close).start()
     with pytest.raises(nfc.llcp.Error) as excinfo:
         tco.recv()
     assert excinfo.value.errno == errno.EPIPE
     with pytest.raises(nfc.llcp.Error) as excinfo:
         tco.recv()
     assert excinfo.value.errno == errno.ESHUTDOWN
Example #4
0
 def test_recv(self, tco):
     pdu = nfc.llcp.pdu.UnnumberedInformation(1, 1, HEX('1122'))
     assert tco.enqueue(pdu) is True
     assert tco.recv() == pdu
     threading.Timer(0.01, tco.close).start()
     with pytest.raises(nfc.llcp.Error) as excinfo:
         tco.recv()
     assert excinfo.value.errno == errno.EPIPE
     with pytest.raises(nfc.llcp.Error) as excinfo:
         tco.recv()
     assert excinfo.value.errno == errno.ESHUTDOWN
Example #5
0
 def test_recv_while_not_established(self, tco):
     with pytest.raises(nfc.llcp.Error) as excinfo:
         tco.recv()
     assert excinfo.value.errno == errno.ENOTCONN
Example #6
0
 def test_recv_while_not_established(self, tco):
     with pytest.raises(nfc.llcp.Error) as excinfo:
         tco.recv()
     assert excinfo.value.errno == errno.ENOTCONN