QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685

以下内容为反编译后的 i.java 源代码,内容仅作参考


package com.tencent.luggage.wxa.ki;

import MTT.WelfareBusiness;
import android.net.http.AndroidHttpClient;
import android.text.TextUtils;
import com.tencent.luggage.wxa.kg.e;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.MulticastSocket;
import java.util.Map;
import org.apache.http.Header;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.util.EntityUtils;

public class i {

    private static i f20731a;

    private MulticastSocket f20732b;

    private InetAddress f20733c;

    private int f20734d;

    public static class a extends HttpPost {

        private e.a f20735a;

        public a(String str, e.a aVar) {
            super(str);
            this.f20735a = aVar;
        }

        @Override
        public String getMethod() {
            return this.f20735a.name();
        }
    }

    private i(boolean z) {
        this.f20734d = -1;
        try {
            this.f20733c = InetAddress.getByName("239.255.255.250");
            if (z) {
                this.f20732b = new MulticastSocket();
                this.f20732b.setBroadcast(true);
                this.f20734d = this.f20732b.getLocalPort();
            }
        } catch (IOException e) {
            com.tencent.luggage.wxa.kf.a.a("TransporterImpl", e, "");
        }
    }

    public static i a() {
        if (f20731a == null) {
            synchronized (com.tencent.luggage.wxa.ki.a.class) {
                if (f20731a == null) {
                    f20731a = new i(true);
                }
            }
        }
        return f20731a;
    }

    public static i b() {
        return new i(false);
    }

    private void b(com.tencent.luggage.wxa.kg.d dVar) throws IOException {
        if (this.f20732b == null) {
            this.f20732b = new MulticastSocket();
            this.f20732b.setBroadcast(true);
            this.f20734d = this.f20732b.getLocalPort();
        }
        byte[] bytes = dVar.b().getBytes();
        this.f20732b.send(new DatagramPacket(bytes, bytes.length, this.f20733c, WelfareBusiness._WELFARE_SHARE));
        this.f20732b.close();
    }

    private void c(com.tencent.luggage.wxa.kg.d dVar) throws IOException {
        byte[] bytes = dVar.b().getBytes();
        this.f20732b.send(new DatagramPacket(bytes, bytes.length, this.f20733c, WelfareBusiness._WELFARE_SHARE));
    }

    public com.tencent.luggage.wxa.kk.e a(com.tencent.luggage.wxa.kg.e eVar) throws IOException {
        AndroidHttpClient androidHttpClient = null;
        try {
            androidHttpClient = AndroidHttpClient.newInstance("");
            a aVar = new a(eVar.f(), eVar.d());
            Map<String, String> e = eVar.e();
            if (e != null && !e.isEmpty()) {
                for (Map.Entry<String, String> entry : e.entrySet()) {
                    aVar.addHeader(entry.getKey(), entry.getValue());
                }
            }
            String b2 = eVar.b();
            if (!TextUtils.isEmpty(b2)) {
                StringEntity stringEntity = new StringEntity(b2, "utf-8");
                stringEntity.setContentType("text/xml; charset=\"utf-8\"");
                aVar.setEntity(stringEntity);
            }
            HttpResponse execute = androidHttpClient.execute(aVar);
            androidHttpClient.close();
            com.tencent.luggage.wxa.kk.e eVar2 = new com.tencent.luggage.wxa.kk.e(false);
            eVar2.f20745b = new com.tencent.luggage.wxa.kk.b();
            for (Header header : execute.getAllHeaders()) {
                eVar2.f20745b.a(header.getName(), header.getValue());
            }
            eVar2.f20746c = j.a().b(EntityUtils.toString(execute.getEntity(), "utf-8").replaceAll("&(?!amp;)", "&amp;"));
            eVar2.f20744a = execute.getStatusLine().getStatusCode();
            return eVar2;
        } catch (IOException e2) {
            if (androidHttpClient != null) {
                androidHttpClient.close();
            }
            com.tencent.luggage.wxa.kf.a.b("TransporterImpl", e2.toString());
            throw e2;
        }
    }

    public void a(com.tencent.luggage.wxa.kg.d dVar) throws IOException {
        if (this == f20731a) {
            c(dVar);
        } else {
            b(dVar);
        }
    }

    public int c() {
        return this.f20734d;
    }

    protected void finalize() throws Throwable {
        if (this == f20731a) {
            this.f20732b.close();
        }
        super.finalize();
    }
}