@@ -113,6 +113,16 @@ public class ChannelManager {
113
113
114
114
private AsyncHttpClientHandler wsHandler ;
115
115
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
+
116
126
public ChannelManager (final AsyncHttpClientConfig config , Timer nettyTimer ) {
117
127
this .config = config ;
118
128
@@ -153,11 +163,11 @@ public ChannelManager(final AsyncHttpClientConfig config, Timer nettyTimer) {
153
163
154
164
if (eventLoopGroup instanceof NioEventLoopGroup ) {
155
165
transportFactory = NioTransportFactory .INSTANCE ;
156
- } else if (eventLoopGroup instanceof EpollEventLoopGroup ) {
166
+ } else if (isInstanceof ( eventLoopGroup , "io.netty.channel.epoll. EpollEventLoopGroup" ) ) {
157
167
transportFactory = new EpollTransportFactory ();
158
- } else if (eventLoopGroup instanceof KQueueEventLoopGroup ) {
168
+ } else if (isInstanceof ( eventLoopGroup , "io.netty.channel.kqueue. KQueueEventLoopGroup" ) ) {
159
169
transportFactory = new KQueueTransportFactory ();
160
- } else if (eventLoopGroup instanceof IOUringEventLoopGroup ) {
170
+ } else if (isInstanceof ( eventLoopGroup , "io.netty.incubator.channel.uring. IOUringEventLoopGroup" ) ) {
161
171
transportFactory = new IoUringIncubatorTransportFactory ();
162
172
} else {
163
173
throw new IllegalArgumentException ("Unknown event loop group " + eventLoopGroup .getClass ().getSimpleName ());
0 commit comments