@Override
        public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
            final Channel child = (Channel) msg;
            final int conn = activeConnections.incrementAndGet();
            if (conn > 0 && conn <= maxNumConnections) {
            serverPortMetric.increaseActiveConnections();
                childChannels.add(child);
                child.closeFuture().addListener(future -> {
                    childChannels.remove(child);
                    activeConnections.decrementAndGet();
                    serverPortMetric.decreaseActiveConnections();
                });
                super.channelRead(ctx, msg);
            } else {
                activeConnections.decrementAndGet();

                // Set linger option to 0 so that the server doesn't get too many TIME_WAIT states.
                child.config().setOption(ChannelOption.SO_LINGER, 0);
                child.unsafe().closeForcibly();

                numDroppedConnections.increment();

                if (loggingScheduled.compareAndSet(false, true)) {
                    ctx.executor().schedule(this::writeNumDroppedConnectionsLog, 1, TimeUnit.SECONDS);
                }
            }
        }
Validates the maximum allowed number of open connections. It must be a positive number.
core/src/main/java/com/linecorp/armeria/server/ConnectionLimitingHandler.java