package com.bytedance.apm.agent.instrumentation;

import com.bytedance.apm.agent.instrumentation.interceptor.AddHeaderInterceptor;
import com.bytedance.apm.agent.instrumentation.okhttp3.OkHttpEventFactory;
import com.bytedance.covode.number.Covode;
import okhttp3.EventListener;
import okhttp3.OkHttpClient;

public class OkHttp3Instrumentation {
    static {
        Covode.recordClassIndex(23050);
    }

    public static OkHttpClient init() {
        OkHttpClient.Builder builder = new OkHttpClient.Builder();
        builder.addInterceptor(new AddHeaderInterceptor());
        builder.eventListenerFactory(new OkHttpEventFactory((EventListener.Factory) null));
        return builder.build();
    }

    public static OkHttpClient build(OkHttpClient.Builder builder) {
        OkHttpClient build = builder.build();
        builder.addInterceptor(new AddHeaderInterceptor());
        builder.eventListenerFactory(new OkHttpEventFactory(build.eventListenerFactory()));
        return builder.build();
    }
}
