class DefaultConnectionSemaphoreFactory implements ConnectionSemaphoreFactory {

    @Override
    public ConnectionSemaphore newConnectionSemaphore(AsyncHttpClientConfig config) {<FILL_FUNCTION_BODY>}
}

        int acquireFreeChannelTimeout = Math.max(0, config.getAcquireFreeChannelTimeout());
        int maxConnections = config.getMaxConnections();
        int maxConnectionsPerHost = config.getMaxConnectionsPerHost();

        if (maxConnections > 0 && maxConnectionsPerHost > 0) {
            return new CombinedConnectionSemaphore(maxConnections, maxConnectionsPerHost, acquireFreeChannelTimeout);
        }
        if (maxConnections > 0) {
            return new MaxConnectionSemaphore(maxConnections, acquireFreeChannelTimeout);
        }
        if (maxConnectionsPerHost > 0) {
            return new CombinedConnectionSemaphore(maxConnections, maxConnectionsPerHost, acquireFreeChannelTimeout);
        }

        return new NoopConnectionSemaphore();
    
<no_super_class>