def test_accept_connect(self, llc, ldl, dlc, peer_miu, send_miu):
with pytest.raises(nfc.llcp.Error) as excinfo:
llc.accept(object())
assert excinfo.value.errno == errno.ENOTSOCK
with pytest.raises(nfc.llcp.Error) as excinfo:
llc.accept(ldl)
assert excinfo.value.errno == errno.EOPNOTSUPP
with pytest.raises(nfc.llcp.Error) as excinfo:
llc.accept(dlc)
assert excinfo.value.errno == errno.EINVAL
connect_pdu = nfc.llcp.pdu.Connect(4, 32, peer_miu)
threading.Timer(0.01, llc.dispatch, (connect_pdu,)).start()
llc.bind(dlc, b'urn:nfc:sn:snep')
llc.listen(dlc, 0)
sock = llc.accept(dlc)
assert isinstance(sock, nfc.llcp.tco.DataLinkConnection)
assert llc.getsockopt(sock, nfc.llcp.SO_SNDMIU) == send_miu
assert llc.getpeername(sock) == 32
assert llc.getsockname(sock) == 4
评论列表
文章目录