def test_no_response_requests(self): """When the request has apduType not 0x01, no reply should be returned from Conpot""" request = ReadPropertyRequest(objectIdentifier=("analogInput", 14), propertyIdentifier=85) request.pduData = bytearray(b"test_data") request.apduMaxResp = 1024 request.apduInvokeID = 101 # Build requests - Confirmed, simple ack pdu, complex ack pdu, error pdu - etc. test_requests = list() for i in range(2, 8): if i not in {1, 3, 4}: request.apduType = i if i == 2: # when apdu.apduType is 2 - we have SimpleAckPDU # set the apduInvokeID and apduService request.apduService = 8 elif i == 5: # when apdu.apduType is 5 - we have ErrorPDU # set the apduInvokeID and apduService request.apduService = 8 elif i == 6: # when apdu.apduType is 6 - we have RejectPDU # set the apduInvokeID and apduAbortRejectReason request.apduAbortRejectReason = 9 else: # when apdu.apduType is 7 - we have AbortPDU # set the apduInvokeID and apduAbortRejectReason request.apduAbortRejectReason = 9 test_requests.append(request) s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) buf_size = 1024 [ s.sendto(i.pduData, ("127.0.0.1", self.bacnet_server.server.server_port)) for i in test_requests ] results = None with gevent.Timeout(1, False): results = [s.recvfrom(buf_size) for i in range(len(test_requests))] self.assertIsNone(results)