1515import io .netty .bootstrap .BootstrapConfig ;
1616import io .netty .channel .Channel ;
1717import io .netty .channel .EventLoopGroup ;
18- import io .netty .channel .epoll .EpollEventLoopGroup ;
1918import io .netty .channel .epoll .EpollSocketChannel ;
20- import io .netty .channel .kqueue .KQueueEventLoopGroup ;
2119import io .netty .channel .kqueue .KQueueSocketChannel ;
22- import io .netty .channel .nio .NioEventLoopGroup ;
2320import io .netty .channel .socket .SocketChannel ;
2421import io .netty .channel .socket .nio .NioSocketChannel ;
2522import org .junit .jupiter .api .Test ;
@@ -283,10 +280,12 @@ private static Stream<Configuration> buildWithExplicitConfigurationProxySupplier
283280 * Tests that a custom {@link io.netty.channel.EventLoopGroup} is properly applied to the Netty client to handle
284281 * sending and receiving requests and responses.
285282 */
283+ @ SuppressWarnings ("deprecation" )
286284 @ Test
287285 public void buildEventLoopClient () {
288286 String expectedThreadName = "testEventLoop" ;
289- NioEventLoopGroup eventLoopGroup = new NioEventLoopGroup (1 , (Runnable r ) -> new Thread (r , expectedThreadName ));
287+ io .netty .channel .nio .NioEventLoopGroup eventLoopGroup
288+ = new io .netty .channel .nio .NioEventLoopGroup (1 , (Runnable r ) -> new Thread (r , expectedThreadName ));
290289
291290 NettyHttpClient nettyClient
292291 = (NettyHttpClient ) new NettyHttpClientBuilder ().eventLoopGroup (eventLoopGroup ).build ();
@@ -307,59 +306,64 @@ private static Stream<Arguments> getTimeoutMillisSupplier() {
307306 Arguments .of (Duration .ofNanos (1 ), TimeUnit .MILLISECONDS .toMillis (1 )));
308307 }
309308
309+ @ SuppressWarnings ("deprecation" )
310310 @ Test
311311 @ EnabledOnOs (OS .WINDOWS )
312312 public void windowsUseNioByDefault () {
313313 NettyHttpClient nettyHttpClient = (NettyHttpClient ) new NettyHttpClientBuilder ().build ();
314314
315315 BootstrapConfig config = nettyHttpClient .getBootstrap ().config ();
316- assertInstanceOf (NioEventLoopGroup .class , config .group ());
316+ assertInstanceOf (io . netty . channel . nio . NioEventLoopGroup .class , config .group ());
317317 assertInstanceOf (NioSocketChannel .class , config .channelFactory ().newChannel ());
318318 }
319319
320+ @ SuppressWarnings ("deprecation" )
320321 @ Test
321322 @ EnabledOnOs (OS .MAC )
322323 public void macUsesKQueueByDefault () {
323324 NettyHttpClient nettyHttpClient = (NettyHttpClient ) new NettyHttpClientBuilder ().build ();
324325
325326 BootstrapConfig config = nettyHttpClient .getBootstrap ().config ();
326- assertInstanceOf (KQueueEventLoopGroup .class , config .group ());
327+ assertInstanceOf (io . netty . channel . kqueue . KQueueEventLoopGroup .class , config .group ());
327328 assertInstanceOf (KQueueSocketChannel .class , config .channelFactory ().newChannel ());
328329 }
329330
331+ @ SuppressWarnings ("deprecation" )
330332 @ Test
331333 @ EnabledOnOs (OS .MAC )
332334 public void macUsesNioIfConfigured () {
333335 NettyHttpClient nettyHttpClient
334336 = (NettyHttpClient ) new NettyHttpClientBuilder ().channelClass (NioSocketChannel .class )
335- .eventLoopGroup (new NioEventLoopGroup ())
337+ .eventLoopGroup (new io . netty . channel . nio . NioEventLoopGroup ())
336338 .build ();
337339
338340 BootstrapConfig config = nettyHttpClient .getBootstrap ().config ();
339- assertInstanceOf (NioEventLoopGroup .class , config .group ());
341+ assertInstanceOf (io . netty . channel . nio . NioEventLoopGroup .class , config .group ());
340342 assertInstanceOf (NioSocketChannel .class , config .channelFactory ().newChannel ());
341343 }
342344
345+ @ SuppressWarnings ("deprecation" )
343346 @ Test
344347 @ EnabledOnOs (OS .LINUX )
345348 public void linuxUsesEpollByDefault () {
346349 NettyHttpClient nettyHttpClient = (NettyHttpClient ) new NettyHttpClientBuilder ().build ();
347350
348351 BootstrapConfig config = nettyHttpClient .getBootstrap ().config ();
349- assertInstanceOf (EpollEventLoopGroup .class , config .group ());
352+ assertInstanceOf (io . netty . channel . epoll . EpollEventLoopGroup .class , config .group ());
350353 assertInstanceOf (EpollSocketChannel .class , config .channelFactory ().newChannel ());
351354 }
352355
356+ @ SuppressWarnings ("deprecation" )
353357 @ Test
354358 @ EnabledOnOs (OS .LINUX )
355359 public void linuxUsesNioIfConfigured () {
356360 NettyHttpClient nettyHttpClient
357361 = (NettyHttpClient ) new NettyHttpClientBuilder ().channelClass (NioSocketChannel .class )
358- .eventLoopGroup (new NioEventLoopGroup ())
362+ .eventLoopGroup (new io . netty . channel . nio . NioEventLoopGroup ())
359363 .build ();
360364
361365 BootstrapConfig config = nettyHttpClient .getBootstrap ().config ();
362- assertInstanceOf (NioEventLoopGroup .class , config .group ());
366+ assertInstanceOf (io . netty . channel . nio . NioEventLoopGroup .class , config .group ());
363367 assertInstanceOf (NioSocketChannel .class , config .channelFactory ().newChannel ());
364368 }
365369
@@ -404,11 +408,12 @@ public void testMaximumHttpVersion() throws NoSuchFieldException, IllegalAccessE
404408 assertEquals (HttpProtocolVersion .HTTP_2 , httpVersionField .get (clientv2 ));
405409 }
406410
411+ @ SuppressWarnings ("deprecation" )
407412 private static Stream <Arguments > getEventLoopGroupToUseSupplier () throws ReflectiveOperationException {
408413 // Doesn't matter what this is calling, just needs to throw an exception.
409414 // This will as it doesn't accept the arguments that it will be called with.
410- MethodHandle exceptionCreator
411- = MethodHandles . publicLookup (). unreflectConstructor (NioEventLoopGroup .class .getDeclaredConstructor ());
415+ MethodHandle exceptionCreator = MethodHandles . publicLookup ()
416+ . unreflectConstructor (io . netty . channel . nio . NioEventLoopGroup .class .getDeclaredConstructor ());
412417
413418 // NOTE: This test doesn't use EpollEventLoopGroup or KQueueEventLoopGroup directly, but rather uses different
414419 // EventLoopGroup classes as the creation of those requires native libraries to be loaded.
@@ -420,8 +425,8 @@ private static Stream<Arguments> getEventLoopGroupToUseSupplier() throws Reflect
420425 .unreflectConstructor (MockKQueueEventLoopGroup .class .getDeclaredConstructor (ThreadFactory .class ));
421426
422427 // EventLoopGroup is configured, use it.
423- Arguments configuredGroup
424- = Arguments . of ( NioEventLoopGroup . class , new NioEventLoopGroup (), null , false , null , false , null );
428+ Arguments configuredGroup = Arguments . of ( io . netty . channel . nio . NioEventLoopGroup . class ,
429+ new io . netty . channel . nio . NioEventLoopGroup (), null , false , null , false , null );
425430
426431 // Epoll is available and nothing is configured, use EpollEventLoopGroup.
427432 Arguments epollGroup = Arguments .of (MockEpollEventLoopGroup .class , null , null , true , epollCreator , false , null );
@@ -431,8 +436,8 @@ private static Stream<Arguments> getEventLoopGroupToUseSupplier() throws Reflect
431436 epollCreator , false , null );
432437
433438 // Epoll is available but throws an exception, use NioEventLoopGroup.
434- Arguments epollExceptionGroup
435- = Arguments . of ( NioEventLoopGroup . class , null , null , true , exceptionCreator , false , null );
439+ Arguments epollExceptionGroup = Arguments . of ( io . netty . channel . nio . NioEventLoopGroup . class , null , null , true ,
440+ exceptionCreator , false , null );
436441
437442 // KQueue is available and nothing is configured, use KQueueEventLoopGroup.
438443 Arguments kqueueGroup
@@ -443,8 +448,8 @@ private static Stream<Arguments> getEventLoopGroupToUseSupplier() throws Reflect
443448 false , null , true , kqueueCreator );
444449
445450 // KQueue is available but throws an exception, use NioEventLoopGroup.
446- Arguments kqueueExceptionGroup
447- = Arguments . of ( NioEventLoopGroup . class , null , null , false , null , true , exceptionCreator );
451+ Arguments kqueueExceptionGroup = Arguments . of ( io . netty . channel . nio . NioEventLoopGroup . class , null , null , false ,
452+ null , true , exceptionCreator );
448453
449454 // Both Epoll and KQueue are available, use EpollEventLoopGroup.
450455 Arguments epollAndKqueueGroup
@@ -456,8 +461,8 @@ private static Stream<Arguments> getEventLoopGroupToUseSupplier() throws Reflect
456461 KQueueSocketChannel .class , true , epollCreator , true , kqueueCreator );
457462
458463 // Both Epoll and KQueue are available but throws an exception, use NioEventLoopGroup.
459- Arguments epollAndKqueueExceptionGroup
460- = Arguments . of ( NioEventLoopGroup . class , null , null , true , exceptionCreator , true , exceptionCreator );
464+ Arguments epollAndKqueueExceptionGroup = Arguments . of ( io . netty . channel . nio . NioEventLoopGroup . class , null , null ,
465+ true , exceptionCreator , true , exceptionCreator );
461466
462467 // Both Epoll and KQueue are available but channel class is set to EpollSocketChannel, use
463468 // EpollEventLoopGroup.
@@ -466,21 +471,23 @@ private static Stream<Arguments> getEventLoopGroupToUseSupplier() throws Reflect
466471
467472 // Both Epoll and KQueue are available but channel class is set to NioSocketChannel, use
468473 // NioEventLoopGroup.
469- Arguments epollAndKqueueChannelNioGroup = Arguments .of (NioEventLoopGroup .class , null , NioSocketChannel . class ,
470- true , epollCreator , true , kqueueCreator );
474+ Arguments epollAndKqueueChannelNioGroup = Arguments .of (io . netty . channel . nio . NioEventLoopGroup .class , null ,
475+ NioSocketChannel . class , true , epollCreator , true , kqueueCreator );
471476
472477 return Stream .of (configuredGroup , epollGroup , epollChannelGroup , epollExceptionGroup , kqueueGroup ,
473478 kqueueChannelGroup , kqueueExceptionGroup , epollAndKqueueGroup , epollAndKqueueChannelGroup ,
474479 epollAndKqueueExceptionGroup , epollAndKqueueChannelExceptionGroup , epollAndKqueueChannelNioGroup );
475480 }
476481
477- public static final class MockEpollEventLoopGroup extends NioEventLoopGroup {
482+ @ SuppressWarnings ("deprecation" )
483+ public static final class MockEpollEventLoopGroup extends io .netty .channel .nio .NioEventLoopGroup {
478484 public MockEpollEventLoopGroup (ThreadFactory threadFactory ) {
479485 super (threadFactory );
480486 }
481487 }
482488
483- public static final class MockKQueueEventLoopGroup extends NioEventLoopGroup {
489+ @ SuppressWarnings ("deprecation" )
490+ public static final class MockKQueueEventLoopGroup extends io .netty .channel .nio .NioEventLoopGroup {
484491 public MockKQueueEventLoopGroup (ThreadFactory threadFactory ) {
485492 super (threadFactory );
486493 }
@@ -496,34 +503,38 @@ public void getChannelClass(Class<?> expected, Class<? extends SocketChannel> co
496503 assertEquals (expected , channelClass );
497504 }
498505
506+ @ SuppressWarnings ("deprecation" )
499507 private static Stream <Arguments > getChannelClassSupplier () {
500508 // Channel class is configured, use it.
501509 Arguments configuredChannel = Arguments .of (NioSocketChannel .class , NioSocketChannel .class , null , false , false );
502510
503511 // Epoll is available and EventLoopGroup is EpollEventLoopGroup, use EpollSocketChannel.
504- Arguments epollChannel = Arguments .of (EpollSocketChannel .class , null , EpollEventLoopGroup .class , true , false );
512+ Arguments epollChannel = Arguments .of (EpollSocketChannel .class , null ,
513+ io .netty .channel .epoll .EpollEventLoopGroup .class , true , false );
505514
506515 // KQueue is available and EventLoopGroup is KQueueEventLoopGroup, use KQueueSocketChannel.
507- Arguments kqueueChannel
508- = Arguments . of ( KQueueSocketChannel . class , null , KQueueEventLoopGroup .class , false , true );
516+ Arguments kqueueChannel = Arguments . of ( KQueueSocketChannel . class , null ,
517+ io . netty . channel . kqueue . KQueueEventLoopGroup .class , false , true );
509518
510519 // Epoll is available and EventLoopGroup is NioEventLoopGroup, use NioSocketChannel.
511- Arguments epollNioChannel = Arguments .of (NioSocketChannel .class , null , NioEventLoopGroup .class , true , false );
520+ Arguments epollNioChannel
521+ = Arguments .of (NioSocketChannel .class , null , io .netty .channel .nio .NioEventLoopGroup .class , true , false );
512522
513523 // KQueue is available and EventLoopGroup is NioEventLoopGroup, use NioSocketChannel.
514- Arguments kqueueNioChannel = Arguments .of (NioSocketChannel .class , null , NioEventLoopGroup .class , false , true );
524+ Arguments kqueueNioChannel
525+ = Arguments .of (NioSocketChannel .class , null , io .netty .channel .nio .NioEventLoopGroup .class , false , true );
515526
516527 // Both Epoll and KQueue are available and EventLoopGroup is NioEventLoopGroup, use NioSocketChannel.
517528 Arguments epollAndKqueueNioChannel
518- = Arguments .of (NioSocketChannel .class , null , NioEventLoopGroup .class , true , true );
529+ = Arguments .of (NioSocketChannel .class , null , io . netty . channel . nio . NioEventLoopGroup .class , true , true );
519530
520531 // Both Epoll and KQueue are available and EventLoopGroup is EpollEventLoopGroup, use EpollSocketChannel.
521- Arguments epollAndKqueueEpollChannel
522- = Arguments . of ( EpollSocketChannel . class , null , EpollEventLoopGroup .class , true , true );
532+ Arguments epollAndKqueueEpollChannel = Arguments . of ( EpollSocketChannel . class , null ,
533+ io . netty . channel . epoll . EpollEventLoopGroup .class , true , true );
523534
524535 // Both Epoll and KQueue are available and EventLoopGroup is KQueueEventLoopGroup, use KQueueSocketChannel.
525- Arguments epollAndKqueueKqueueChannel
526- = Arguments . of ( KQueueSocketChannel . class , null , KQueueEventLoopGroup .class , true , true );
536+ Arguments epollAndKqueueKqueueChannel = Arguments . of ( KQueueSocketChannel . class , null ,
537+ io . netty . channel . kqueue . KQueueEventLoopGroup .class , true , true );
527538
528539 return Stream .of (configuredChannel , epollChannel , kqueueChannel , epollNioChannel , kqueueNioChannel ,
529540 epollAndKqueueNioChannel , epollAndKqueueEpollChannel , epollAndKqueueKqueueChannel );
0 commit comments