NettyPoolUtil { public static SimpleObjectPool<NettyClient> createNettyPool(Endpoint target){ try { XpipeNettyClientPool xpipeObjectPool = new XpipeNettyClientPool(target); xpipeObjectPool.initialize(); xpipeObjectPool.start(); return xpipeObjectPool; } catch (Exception e) { throw new IllegalStateException("[createNettyPool]" + target, e); } }  static SimpleObjectPool<NettyClient> createNettyPool(Endpoint target);  }
@Test public void testCreateNettyPool() { }
@Test public void testMakeObjectNoTooMuchEventLoops() throws Exception { int tasks = 100; Server server = startServer("+PONG"); int beforeSize = Thread.getAllStackTraces().size(); for(int i = 0; i < tasks; i++) { SimpleObjectPool<NettyClient> pool = NettyPoolUtil.createNettyPool(new DefaultEndPoint(LOCAL_HOST, server.getPort())); pool.borrowObject().sendRequest(Unpooled.copiedBuffer("+PING\r\n".getBytes())); } int afterSize = Thread.getAllStackTraces().size(); logger.info("[delta size] {}", afterSize - beforeSize); Assert.assertTrue(afterSize - beforeSize < tasks); }