File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
src/main/java/io/theves/denon4j Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 28
28
import java .util .*;
29
29
import java .util .logging .Level ;
30
30
import java .util .logging .Logger ;
31
+ import java .util .stream .Collectors ;
31
32
32
33
import static java .lang .String .format ;
33
34
@@ -446,10 +447,14 @@ public boolean isConnected() {
446
447
return protocol .isConnected ();
447
448
}
448
449
449
- public Event send (String command , String regex ) {
450
- return send (command , Condition .regex (regex )).stream ().findFirst ().orElseThrow (() -> new TimeoutException (
451
- format ("No response received after %s milliseconds. Receiver may be too busy to respond." , RECV_TIMEOUT )
452
- ));
450
+ public Event send (final String command ,final String regex ) {
451
+
452
+ return send (command , Condition .regex (regex ))
453
+ .stream ()
454
+ .filter (event -> event .asciiValue ().matches (regex ))
455
+ .findFirst ().orElseThrow (() -> new TimeoutException (
456
+ format ("No response received after %s milliseconds. Receiver may be too busy to respond." , RECV_TIMEOUT )
457
+ ));
453
458
}
454
459
455
460
/**
You can’t perform that action at this time.
0 commit comments