QosLink implements Link { public long sendTone(Tone tone) throws IOException { return extractId(newAwaiter().waitForResponse(delegate.sendTone(tone))); } QosLink(Link link);  QosLink(Link link, long timeout, TimeUnit timeUnit); void close(); Link addListener(EventListener listener); Link removeListener(EventListener listener); Link addRplyListener(RplyListener listener); Link removeRplyListener(RplyListener listener); Link addCustomListener(CustomListener listener); Link removeCustomListener(CustomListener listener); long startListening(Pin pin); long stopListening(Pin pin); long switchAnalogPin(AnalogPin analogPin, int value); long switchDigitalPin(DigitalPin digitalPin, boolean value); long sendKeyPressEvent(char keychar, int keycode, int keylocation,
			int keymodifiers, int keymodifiersex); long sendTone(Tone tone); long sendNoTone(AnalogPin analogPin); long sendCustomMessage(String... messages); @Deprecated // quick fix for https://github.com/Ardulink/Ardulink-2/issues/43 Link getDelegate();  }
@Test public void secondCallPassesIfFirstOneKeepsUnresponded() throws Exception { arduino.whenReceive(regex("alp:\\/\\/tone\\/1/2/3\\?id\\=(\\d)")) .thenDoNotRespond(); arduino.whenReceive(regex("alp:\\/\\/tone\\/4/5/6\\?id\\=(\\d)")) .thenRespond("alp: qosLink = newQosLink(connectionTo(arduino), 500, MILLISECONDS); try { qosLink.sendTone(Tone.forPin(analogPin(1)).withHertz(2) .withDuration(3, MILLISECONDS)); } catch (IllegalStateException e) { assertThat(e.getMessage(), containsString("No response")); } qosLink.sendTone(Tone.forPin(analogPin(4)).withHertz(5) .withDuration(6, MILLISECONDS)); }