All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.eg.agent.android.instrumentation.InstrumentOkHttp3 Maven / Gradle / Ivy

The newest version!
/*
 * Decompiled with CFR 0.137.
 */
package com.eg.agent.android.instrumentation;

import com.eg.agent.android.instrumentation.HttpURLConnectionExtension;
import com.eg.agent.android.instrumentation.HttpsURLConnectionExtension;
import com.eg.agent.android.instrumentation.httphelper.Wrapper;
import com.eg.agent.android.logging.EGAgentLog;
import com.eg.agent.android.logging.EGAgentLogManager;

import java.net.HttpURLConnection;
import javax.net.ssl.HttpsURLConnection;

public class InstrumentOkHttp3 {
	
	private static EGAgentLog log = EGAgentLogManager.getAgentLog();
    

    @Wrapper(className="okhttp3/OkHttpClient", methodName="open", methodDesc="(Ljava/net/URL;)Ljava/net/HttpURLConnection;")
    public static HttpURLConnection open(HttpURLConnection connection) {
        if (connection instanceof HttpsURLConnection) {
            return new HttpsURLConnectionExtension((HttpsURLConnection)connection);
        }
        if (connection != null) {
            return new HttpURLConnectionExtension(connection);
        }
        return null;
    }

    @Wrapper(className="okhttp3/OkHttpClient", methodName="open", methodDesc="(Ljava/net/URL;Ljava/net/Proxy)Ljava/net/HttpURLConnection;")
    public static HttpURLConnection openWithProxy(HttpURLConnection connection) {
        if (connection instanceof HttpsURLConnection) {
            return new HttpsURLConnectionExtension((HttpsURLConnection)connection);
        }
        if (connection != null) {
            return new HttpURLConnectionExtension(connection);
        }
        return null;
    }

    @Wrapper(className="okhttp3/OkUrlFactory", methodName="open", methodDesc="(Ljava/net/URL;)Ljava/net/HttpURLConnection;")
    public static HttpURLConnection urlFactoryOpen(HttpURLConnection connection) {
        log.debug("InstrumentOkHttp - wrapping return of call to OkUrlFactory.open...");
        if (connection instanceof HttpsURLConnection) {
            return new HttpsURLConnectionExtension((HttpsURLConnection)connection);
        }
        if (connection != null) {
            return new HttpURLConnectionExtension(connection);
        }
        return null;
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy