addClient(new BaseHandler());
void runWithBaseServer(NettyServerDataConstructor nsdc, NettyClientRouterConstructor ncrc, NettyCommFunction actionFn) throws Exception { int port = findRandomOpenPort(); NettyServerData d = nsdc.createNettyServerData(port); NettyClientRouter ncr = null; try { d.bootstrapServer(); ncr = ncrc.createNettyClientRouter(port); ncr.addClient(new BaseHandler()); ncr.start(); actionFn.runTest(ncr, d); } catch (Exception ex) { log.error("Exception ", ex); throw ex; } finally { try { if (ncr != null) {ncr.stop(true);} } catch (Exception ex) { log.warn("Error shutting down client...", ex); } d.shutdownServer(); } }