@Test public void testFragmentedResponse2() throws Exception { int numOfTelegrams = 30000; Deque<Byte> buffer = new LinkedList<Byte>(); Random rand = new Random(47); int payload = 0; for(int i = 0; i < numOfTelegrams; i++) { Esp3RPSTelegram telegram = new Esp3RPSTelegram(senderID, (byte)payload, (byte)0x00); ++payload; byte[] packetBytes = telegram.asByteArray(); for(byte dataByte : packetBytes) { buffer.add(dataByte); } } while(buffer.size() > 0) { int size = Math.min(rand.nextInt(radioTelegram.asByteArray().length / 2), buffer.size()); byte[] data = new byte[size]; for(int i = 0; i < size; i++) { data[i] = buffer.removeFirst(); } mockPort.addDataToReturn(data); } RadioListener listener = new RadioListener(120, numOfTelegrams); processor.setProcessorListener(listener); processor.start(); List<EspRadioTelegram> receivedTelegrams = listener.waitForRadioTelegrams(); Assert.assertNotNull(receivedTelegrams); Assert.assertEquals(numOfTelegrams, receivedTelegrams.size()); int expectedPayload = 0; for(EspRadioTelegram telegram : receivedTelegrams) { byte receivedPayload = telegram.getPayload()[0]; Assert.assertTrue((byte)expectedPayload == receivedPayload); ++expectedPayload; } }
public void setProcessorListener(Esp3ProcessorListener listener) { this.listener = listener; }
Esp3Processor extends AbstractEspProcessor<Esp3Packet> { public void setProcessorListener(Esp3ProcessorListener listener) { this.listener = listener; } }
Esp3Processor extends AbstractEspProcessor<Esp3Packet> { public void setProcessorListener(Esp3ProcessorListener listener) { this.listener = listener; } Esp3Processor(Esp3ComPortAdapter port); }
Esp3Processor extends AbstractEspProcessor<Esp3Packet> { public void setProcessorListener(Esp3ProcessorListener listener) { this.listener = listener; } Esp3Processor(Esp3ComPortAdapter port); void setProcessorListener(Esp3ProcessorListener listener); }
Esp3Processor extends AbstractEspProcessor<Esp3Packet> { public void setProcessorListener(Esp3ProcessorListener listener) { this.listener = listener; } Esp3Processor(Esp3ComPortAdapter port); void setProcessorListener(Esp3ProcessorListener listener); static final long ESP3_RESPONSE_TIMEOUT; }