@@ -113,6 +113,16 @@ public class ChannelManager {
113113
114114 private AsyncHttpClientHandler wsHandler ;
115115
116+ private boolean isInstanceof (Object object , String name ) {
117+ final Class <?> clazz ;
118+ try {
119+ clazz = Class .forName (name , false , null );
120+ } catch (ClassNotFoundException ignored ) {
121+ return false ;
122+ }
123+ return clazz .isInstance (object );
124+ }
125+
116126 public ChannelManager (final AsyncHttpClientConfig config , Timer nettyTimer ) {
117127 this .config = config ;
118128
@@ -153,11 +163,11 @@ public ChannelManager(final AsyncHttpClientConfig config, Timer nettyTimer) {
153163
154164 if (eventLoopGroup instanceof NioEventLoopGroup ) {
155165 transportFactory = NioTransportFactory .INSTANCE ;
156- } else if (eventLoopGroup instanceof EpollEventLoopGroup ) {
166+ } else if (isInstanceof ( eventLoopGroup , "io.netty.channel.epoll. EpollEventLoopGroup" ) ) {
157167 transportFactory = new EpollTransportFactory ();
158- } else if (eventLoopGroup instanceof KQueueEventLoopGroup ) {
168+ } else if (isInstanceof ( eventLoopGroup , "io.netty.channel.kqueue. KQueueEventLoopGroup" ) ) {
159169 transportFactory = new KQueueTransportFactory ();
160- } else if (eventLoopGroup instanceof IOUringEventLoopGroup ) {
170+ } else if (isInstanceof ( eventLoopGroup , "io.netty.incubator.channel.uring. IOUringEventLoopGroup" ) ) {
161171 transportFactory = new IoUringIncubatorTransportFactory ();
162172 } else {
163173 throw new IllegalArgumentException ("Unknown event loop group " + eventLoopGroup .getClass ().getSimpleName ());
0 commit comments