/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.common.http.GenericHttpClient
 *  com.l7tech.common.http.GenericHttpClientFactory
 *  com.l7tech.common.http.HttpProxyConfig
 *  com.l7tech.common.http.prov.apache.components.ClientConnectionManagerFactory
 *  com.l7tech.common.http.prov.apache.components.ClientConnectionManagerFactory$ConnectionManagerType
 *  com.l7tech.common.http.prov.apache.components.HttpComponentsClient
 *  org.apache.hc.client5.http.io.HttpClientConnectionManager
 *  org.jetbrains.annotations.Nullable
 */
package com.l7tech.server.policy.assertion;

import com.l7tech.common.http.GenericHttpClient;
import com.l7tech.common.http.GenericHttpClientFactory;
import com.l7tech.common.http.HttpProxyConfig;
import com.l7tech.common.http.prov.apache.components.ClientConnectionManagerFactory;
import com.l7tech.common.http.prov.apache.components.HttpComponentsClient;
import com.l7tech.server.policy.assertion.ServerHttpRoutingAssertion;
import com.l7tech.server.transport.http.HttpConnectionManagerListener;
import org.apache.hc.client5.http.io.HttpClientConnectionManager;
import org.jetbrains.annotations.Nullable;

class t
implements GenericHttpClientFactory {
    private HttpClientConnectionManager a;
    final boolean val$useHttp10;
    final HttpConnectionManagerListener val$listener;

    /*
     * Ignored method signature, as it can't be verified against descriptor
     */
    t(ServerHttpRoutingAssertion serverHttpRoutingAssertion, boolean bl2, HttpConnectionManagerListener httpConnectionManagerListener) {
        this.val$useHttp10 = bl2;
        this.val$listener = httpConnectionManagerListener;
        this.a = null;
    }

    public GenericHttpClient createHttpClient() {
        return this.createHttpClient(-1, -1, -1, -1, -1, null, null);
    }

    public GenericHttpClient createHttpClient(int n2, int n3, int n4, int n5, int n6, Object object, @Nullable HttpProxyConfig httpProxyConfig) {
        return new HttpComponentsClient(this.a(n2, n3), object, n4, n5, n6, httpProxyConfig);
    }

    private HttpClientConnectionManager a(int n2, int n3) {
        if (this.a == null) {
            this.a = ClientConnectionManagerFactory.getInstance().createConnectionManager(ClientConnectionManagerFactory.ConnectionManagerType.POOLING, n2 <= 0 ? HttpComponentsClient.getDefaultMaxConnectionsPerHost() : n2, n3 <= 0 ? HttpComponentsClient.getDefaultMaxTotalConnections() : n3, this.val$useHttp10);
            this.val$listener.notifyHttpConnectionManagerCreated(this.a);
        }
        return this.a;
    }
}

