2828import tel .schich .javacan .CanFrame ;
2929import tel .schich .javacan .CanSocketOptions ;
3030import tel .schich .javacan .RawCanChannel ;
31+ import tel .schich .javacan .linux .epoll .EPollSelector ;
3132import tel .schich .javacan .select .ExtensibleSelectorProvider ;
3233import tel .schich .javacan .test .CanTestHelper ;
3334
3435import java .io .IOException ;
3536import java .nio .channels .SelectionKey ;
37+ import java .nio .channels .Selector ;
3638import java .nio .channels .spi .AbstractSelector ;
3739import java .util .Set ;
3840
3941import static java .time .Duration .ofMillis ;
4042import static org .junit .jupiter .api .Assertions .*;
41- import static tel .schich .javacan .CanChannels .PROVIDER ;
4243import static tel .schich .javacan .CanFrame .FD_NO_FLAGS ;
4344import static tel .schich .javacan .CanSocketOptions .RECV_OWN_MSGS ;
4445import static tel .schich .javacan .test .CanTestHelper .CAN_INTERFACE ;
@@ -55,7 +56,7 @@ public void testOpenClose() throws IOException {
5556 @ Test
5657 public void testWriteRead () throws IOException {
5758 try (RawCanChannel ch = CanChannels .newRawChannel ()) {
58- try (AbstractSelector selector = ch . provider (). openSelector ()) {
59+ try (Selector selector = EPollSelector . open ()) {
5960 ch .setOption (RECV_OWN_MSGS , true );
6061 ch .configureBlocking (false );
6162 ch .bind (CAN_INTERFACE );
@@ -79,8 +80,7 @@ public void testWriteRead() throws IOException {
7980
8081 @ Test
8182 public void testWakeup () throws IOException {
82- ExtensibleSelectorProvider provider = new ExtensibleSelectorProvider ();
83- try (AbstractSelector selector = provider .openSelector ()) {
83+ try (AbstractSelector selector = EPollSelector .open ()) {
8484 runDelayed (ofMillis (100 ), selector ::wakeup );
8585 assertTimeoutPreemptively (ofMillis (200 ), (Executable ) selector ::select );
8686 }
@@ -89,7 +89,7 @@ public void testWakeup() throws IOException {
8989 @ Test
9090 public void testPollWithClosedChannel () throws IOException {
9191
92- try (final AbstractSelector selector = PROVIDER . openSelector ()) {
92+ try (final Selector selector = EPollSelector . open ()) {
9393
9494 RawCanChannel firstChannel = configureAndRegisterChannel (selector );
9595 firstChannel .close ();
@@ -102,7 +102,7 @@ public void testPollWithClosedChannel() throws IOException {
102102 @ Test
103103 public void testEPollFdReuse () throws IOException , InterruptedException {
104104
105- try (final AbstractSelector selector = PROVIDER . openSelector ()) {
105+ try (final AbstractSelector selector = EPollSelector . open ()) {
106106
107107 try (RawCanChannel firstChannel = configureAndRegisterChannel (selector )) {
108108 CanTestHelper .sendFrameViaUtils (CAN_INTERFACE , CanFrame .create (0x3 , CanFrame .FD_NO_FLAGS , new byte [] {1 }));
@@ -122,7 +122,7 @@ public void testEPollFdReuse() throws IOException, InterruptedException {
122122 }
123123 }
124124
125- private static RawCanChannel configureAndRegisterChannel (AbstractSelector selector ) throws IOException {
125+ private static RawCanChannel configureAndRegisterChannel (Selector selector ) throws IOException {
126126 final RawCanChannel ch = CanChannels .newRawChannel (CAN_INTERFACE );
127127 System .out .println ("Created channel: " + ch );
128128
0 commit comments