package epson.print.copy.Component.eremoteoperation;

import android.util.Log;
import com.epson.iprint.prtlogger.Analytics;
import com.epson.mobilephone.common.wifidirect.ActivityControlWiFi;
import com.epson.mobilephone.common.wifidirect.WiFiDirectManager;
import epson.common.IPAddressUtils;
import epson.common.httpclient.BasicNameValuePair;
import epson.common.httpclient.IAHttpClient;
import epson.print.CommonDefine;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.lang.CharEncoding;
import org.json.JSONObject;

public class ERemoteOperation {
    String hostIP;
    int requestConnectionTimeout = ActivityControlWiFi.SCANNING_TIMEOUT;

    public interface IRemoteOperationParameter {
        String client_id();
    }

    public interface IRemoteStatusParameter extends IRemoteOperationParameter {
        ArrayList<ERemoteParam> keys();
    }

    public void setHostIP(String str) {
        this.hostIP = new String(str);
    }

    public String getHostIP() {
        return this.hostIP;
    }

    public void setRequestConnectionTimeout(int i) {
        this.requestConnectionTimeout = i;
    }

    public int getRequestConnectionTimeout() {
        return this.requestConnectionTimeout;
    }

    public enum ERemoteParam {
        client_id("client-id"),
        success("success"),
        reason("reason"),
        illegal_combination("illegal_combination"),
        illegal_state("illegal_state"),
        already_finished("already_finished"),
        unknown_token("unknown_token"),
        busy("busy"),
        job_token("job-token"),
        next_document("next-document"),
        functions("functions"),
        keys("keys"),
        device("device"),
        printer(WiFiDirectManager.DEVICE_TYPE_PRINTER),
        scanner(WiFiDirectManager.DEVICE_TYPE_SCANNER),
        copy("copy"),
        copy_photo("copy_photo"),
        repeat_copy("repeat_copy"),
        print_x_disc_tray_state("print-x-disc-tray-state"),
        media_empty("media-empty"),
        tray_set("tray-set"),
        tray_missing("tray-missing"),
        printer_state("printer-state"),
        scanner_state("scanner-state"),
        idle("idle"),
        processing("processing"),
        stopped("stopped"),
        printer_state_reasons("printer-state-reasons"),
        none("none"),
        marker_supply_empty_error("marker-supply-empty-error"),
        marker_waste_full_error("marker-waste-full-error"),
        media_jam_error("media-jam-error"),
        media_empty_error("media-empty-error"),
        input_tray_missing_error("input-tray-missing-error"),
        cover_open_error("cover-open-error"),
        output_area_full_error("output-area-full-error"),
        other_error("other-error"),
        marker_supply_low_warning("marker-supply-low-warning"),
        cover_open("cover-open"),
        scanner_state_reasons("scanner-state-reasons"),
        media_size_missmatch_error("media-size-missmatch-error"),
        document_on_adf("document-on-adf"),
        components("components"),
        disc_tray("disc-tray"),
        adf("adf"),
        layout("layout"),
        standard("standard"),
        borderless("borderless"),
        two_up("2-up"),
        two_up_book("2-up-book"),
        book_two_sided("book-two-sided"),
        mirror("mirror"),
        upper_half("upper-half"),
        lower_half("lower_half"),
        _3_up("3-up"),
        _4_up("4-up"),
        _9_up("9-up"),
        _16_up("16-up"),
        scan_sides("scan-sides"),
        print_sides("print-sides"),
        one_sided("one-sided"),
        two_sided_short_edge("two-sided-short-edge"),
        two_sided_long_edge("two-sided-long-edge"),
        x_two_sided("x-two-sided"),
        scan_media_size("scan-media-size"),
        unused("unused"),
        iso_a4_210x297mm("iso_a4_210x297mm"),
        jis_b4_257x364mm("jis_b4_257x364mm"),
        jis_b5_182x257mm("jis_b5_182x257mm"),
        print_media_type("print-media-type"),
        stationery("stationery"),
        photographic_high_gloss("photographic-high-gloss"),
        photographic("photographic"),
        photographic_semi_gloss("photographic-semi-gloss"),
        photographic_glossy("photographic-glossy"),
        custom_media_type_epson_44("custom-media-type-epson-44"),
        photographic_matte("photographic-matte"),
        stationery_coated("stationery-coated"),
        custom_media_type_epson_2a("custom-media-type-epson-2a"),
        stationery_inkjet("stationery-inkjet"),
        custom_media_type_epson_1b("custom-media-type-epson-1b"),
        custom_media_type_epson_02("custom-media-type-epson-02"),
        custom_media_type_epson_19("custom-media-type-epson-19"),
        custom_media_type_epson_22("custom-media-type_epson-22"),
        labels("labels"),
        envelope("envelope"),
        custom_media_type_epson_47("custom-media-type-epson-47"),
        custom_media_type_epson_20("custom-media-type-epson-20"),
        custom_media_type_epson_39("custom-media-type-epson-39"),
        custom_media_type_epson_46("custom-media-type-epson-46"),
        stationery_heavyweight("stationery-heavyweight"),
        stationery_letterhead("stationery-letterhead"),
        print_media_size("print-media-size"),
        oe_photo_l_3_5x5in("oe_photo-l_3.5x5in"),
        na_5x7_5x7in("na_5x7_5x7in"),
        jpn_hagaki_100x148mm("jpn_hagaki_100x148mm"),
        na_index_4x6_4x6in("na_index-4x6_4x6in"),
        na_govt_letter_8x10in("na_govt-letter_8x10in"),
        na_letter_8_5x11in("na_letter_8.5x11in"),
        na_legal_8_5x14in("na_legal_8.5x14in"),
        iso_a5_148x210mm("iso_a5_148x210mm"),
        custom_4psize_254x305mm("custom_4psize_254x305mm"),
        iso_a3_297x420mm("iso_a3_297x420mm"),
        na_ledger_11x17in("na_ledger_11x17in"),
        iso_a6_105x148mm("iso_a6_105x148mm"),
        jpn_chou3_120x235mm("jpn_chou3_120x235mm"),
        jpn_chou4_90x205mm("jpn_chou4_90x205mm"),
        custom_epson_18_120x176mm("custom_epson-18_120x176mm"),
        custom_epson_1A_98x148mm("custom_epson-1A_98x148mm"),
        jpn_you4_105x235mm("jpn_you4_105x235mm"),
        iso_c6_114x162mm("iso_c6_114x162mm"),
        jpn_kaku2_240x332mm("jpn_kaku2_240x332mm"),
        iso_c4_229x324mm("iso_c4_229x324mm"),
        custom_cardsize_55x91mm("custom_cardsize_55x91mm"),
        custom_creditcardsize_54x86mm("custom_creditcardsize_54x86mm"),
        custom_hivision_101_6x180_6mm("custom_hivision_101.6x180.6mm"),
        iso_dl_110x220mm("iso_dl_110x220mm"),
        jis_b6_128x182mm("jis_b6_128x182mm"),
        na_executive_7_25x10_5in("na_executive_7.25x10.5in"),
        na_foolscap_8_5x13in("na_foolscap_8.5x13in"),
        na_edp_11x14in("na_edp_11x14in"),
        na_number_10_4_125x9_5in("na_number-10_4.125x9.5in"),
        om_8k_270x390mm("om_8k_270x390mm"),
        om_16k_195x270mm("om_16k_195x270mm"),
        na_invoice_5_5x8_5in("na_invoice_5.5x8.5in"),
        custom_epson_indianlegal_215x345mm("custom_epson-indianlegal_215x345mm"),
        na_oficio_8_5x13_4in("na_oficio_8.5x13.4in"),
        om_folio_sp_215x315mm("om_folio-sp_215x315mm"),
        scan_content_type("scan-content-type"),
        text("text"),
        mixed("mixed"),
        print_media_source("print-media-source"),
        top("top"),
        bottom("bottom"),
        manual("manual"),
        rear("rear"),
        print_quality("print-quality"),
        draft("draft"),
        normal("normal"),
        high("high"),
        best("x-best"),
        print_sheet_collate("print-sheet-collate"),
        collated("collated"),
        uncollated("uncollated"),
        fixed_parameters("fixed-parameters"),
        preferred_parameters("preferred-parameters"),
        priority_order("priority-order"),
        default_as_fixed("default-as-fixed"),
        frame("frame"),
        oval("oval"),
        oval_soft_edge("oval-soft-edge"),
        copies("copies"),
        color_effects_type("color-effects-type"),
        color("color"),
        monochrome_grayscale("monochrome-grayscale"),
        copy_magnification("copy-magnification"),
        auto("auto"),
        x_density("x-density"),
        print_x_bleed("print-x-bleed"),
        midium("midium"),
        minimum("minimum"),
        orientation("orientation"),
        portrait("portrait"),
        landscape("landscape"),
        print_x_dry_time("print-x-dry-time"),
        Long("long"),
        longer("longer"),
        print_x_auto_pg("print-x-auto-pg"),
        on("on"),
        off("off"),
        job_state("job-state"),
        nextpaper("nextpaper"),
        scanning("scanning"),
        printing("printing"),
        copying("copying"),
        canceling("canceling"),
        finished("finished"),
        pending("pending"),
        pending_for_template("pending-for-template"),
        waiting_image_for_template("waiting-image-for-template"),
        printing_template("printing-template"),
        waiting_image("waiting-image"),
        waiting_template("waiting-template"),
        job_result("job-result"),
        canceled("canceled"),
        memory_full("memory_full"),
        remove_adf_paper("remove_adf_paper"),
        set_adf_paper("set_adf_paper"),
        document_error("document_error"),
        image_too_large("image-too-large"),
        communication_error("communication-error"),
        job_tokens("job-tokens"),
        job_print_total_pages("job-print-total-pages"),
        job_print_current_pages("job-print-current-pages"),
        job_image_post_url("job-image-post-url"),
        x_apf("x-apf"),
        x_color_restoration("x-color-restoration"),
        scan_count("scan-count"),
        scan_area_x("scan-area-x"),
        scan_area_y("scan-area-y"),
        scan_area_width("scan-area-width"),
        scan_area_height("scan-area-height"),
        scan_area_resolution("scan-area-resolution"),
        x_fit_gamma("x-fit-gamma"),
        x_fit_matrix("x-fit-matrix"),
        x_scale("x-scale"),
        x_scale_fullsize("x-scale-fullsize"),
        x_scale_custom("x-scale-custom"),
        x_scale_autofit("x-scale-autofit"),
        x_scale_a4_to_postcard("x-scale-a4-to-postcard"),
        x_scale_2l_to_postcard("x-scale-2l-to-postcard"),
        x_scale_l_to_postcard("x-scale-l-to-postcard"),
        x_scale_l_to_2l("x-scale-l-to-2l"),
        x_scale_2l_to_a4("x-scale-2l-to-a4"),
        x_scale_postcard_to_a4("x-scale-postcard-to-a4"),
        x_scale_l_to_a4("x-scale-l-to-a4"),
        x_scale_a4_to_b5("x-scale-a4-to-b5"),
        x_scale_b5_to_a4("x-scale-b5-to-a4"),
        x_scale_letter_to_kg("x-scale-letter-to-kg"),
        x_scale_kg_to_letter("x-scale-kg-to-letter"),
        x_scale_letter_to_2l("x-scale-letter-to-2l"),
        x_scale_2l_to_letter("x-scale-2l-to-letter"),
        x_scale_kg_to_a4("x-scale-kg-to-a4"),
        x_scale_a4_to_kg("x-scale-a4-to-kg"),
        x_scale_a4_to_2l("x-scale-a4-to-2l"),
        x_scale_kg_to_8x10("x-scale-kg-to-8x10"),
        x_scale_8x10_to_2l("x-scale-8x10-to-2l"),
        x_scale_legal_to_letter("x-scale-legal-to-letter"),
        x_scale_2l_to_kg("x-scale-2l-to-kg"),
        x_scale_kg_to_2l("x-scale-kg-to-2l"),
        x_scale_a5_to_a4("x-scale-a5-to-a4"),
        x_scale_a4_to_a5("x-scale-a4-to-a5"),
        x_scale_a4_to_a3("x-scale-a4-to-a3"),
        x_scale_letter_to_11x17("x-scale-letter-to-11x17"),
        x_borderless("layout"),
        x_null(""),
        x_failed_communication("x-failed-communication"),
        x_unknown("x-unknown"),
        x_invalid_photo_setting("x-invalid-photo-setting");
        
        public String string;

        private ERemoteParam(String str) {
            this.string = str;
        }

        public static ERemoteParam stringOf(String str) {
            for (ERemoteParam eRemoteParam : values()) {
                if (eRemoteParam.string.compareTo(str) == 0) {
                    return eRemoteParam;
                }
            }
            return x_null;
        }

        public String toString() {
            return this.string;
        }
    }

    enum RequestParam {
        remote_operation("remote_operation"),
        v1("v1"),
        HTTP(Analytics.EXTENSION_STRING_WEB),
        Content_Type("application/x-www-form-urlencoded"),
        User_Agent("Mozilla/5.0"),
        device("device"),
        printer(WiFiDirectManager.DEVICE_TYPE_PRINTER),
        scanner(WiFiDirectManager.DEVICE_TYPE_SCANNER),
        copy("copy"),
        copy_photo("copy_photo"),
        combo("combo"),
        get_functions("get_functions"),
        get_status("get_status"),
        get_components("get_components"),
        get_options("get_options"),
        clear_error("clear_error"),
        cancel("cancel"),
        document_changed("document_changed");
        
        public String string;

        private RequestParam(String str) {
            this.string = str;
        }
    }

    public static class ERemoteOperationResult {
        JSONObject json;
        ERemoteRequestBuilder request;

        static JSONObject parseResponse(IAHttpClient.HttpResponse httpResponse) {
            JSONObject jSONObject = new JSONObject();
            try {
                ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                httpResponse.getEntity().writeTo(byteArrayOutputStream);
                Log.d("ERequest C", byteArrayOutputStream.toString());
                return new JSONObject(byteArrayOutputStream.toString());
            } catch (Exception e) {
                e.printStackTrace();
                return jSONObject;
            }
        }

        public ERemoteOperationResult(JSONObject jSONObject) {
            this.json = jSONObject;
        }

        public String toString() {
            return this.json.toString();
        }

        public boolean isNull(ERemoteParam eRemoteParam) {
            return this.json.isNull(eRemoteParam.string);
        }

        public void setRemoteRequestBuilder(ERemoteRequestBuilder eRemoteRequestBuilder) {
            this.request = eRemoteRequestBuilder;
        }

        public boolean success() {
            try {
                return this.json.getBoolean(ERemoteParam.success.string);
            } catch (Exception e) {
                e.printStackTrace();
                return false;
            }
        }

        private boolean getBooleanValueOf(ERemoteParam eRemoteParam) {
            try {
                return this.json.getBoolean(eRemoteParam.string);
            } catch (Exception e) {
                e.printStackTrace();
                return false;
            }
        }

        private int getIntValueOf(ERemoteParam eRemoteParam) {
            try {
                return this.json.getInt(eRemoteParam.string);
            } catch (Exception e) {
                e.printStackTrace();
                return 0;
            }
        }

        private String getStringValueOf(ERemoteParam eRemoteParam) {
            try {
                return this.json.getString(eRemoteParam.string);
            } catch (Exception e) {
                e.printStackTrace();
                return "";
            }
        }

        private ArrayList<String> getStringsValueOf(ERemoteParam eRemoteParam) {
            ArrayList<String> arrayList = new ArrayList<>();
            try {
                for (String trim : this.json.getString(eRemoteParam.string).split(PreferencesConstants.COOKIE_DELIMITER)) {
                    arrayList.add(trim.trim());
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return arrayList;
        }

        private ERemoteParam getParamValueOf(ERemoteParam eRemoteParam) {
            ERemoteParam eRemoteParam2 = ERemoteParam.x_null;
            try {
                return ERemoteParam.stringOf(this.json.getString(eRemoteParam.string));
            } catch (Exception e) {
                e.printStackTrace();
                return eRemoteParam2;
            }
        }

        private ERemoteParam getDefaultValueOf(ERemoteParam eRemoteParam) {
            ERemoteParam eRemoteParam2 = ERemoteParam.x_null;
            try {
                JSONObject jSONObject = this.json;
                return ERemoteParam.stringOf(jSONObject.getString(eRemoteParam.string + "-default"));
            } catch (Exception e) {
                e.printStackTrace();
                return eRemoteParam2;
            }
        }

        private ArrayList<ERemoteParam> getOptionsValueOf(ERemoteParam eRemoteParam) {
            ArrayList<ERemoteParam> arrayList = new ArrayList<>();
            try {
                for (String trim : this.json.getString(eRemoteParam.string + "-options").split(PreferencesConstants.COOKIE_DELIMITER)) {
                    ERemoteParam stringOf = ERemoteParam.stringOf(trim.trim());
                    if (stringOf != ERemoteParam.x_null) {
                        arrayList.add(stringOf);
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return arrayList;
        }

        private ArrayList<ERemoteParam> getParamsValueOf(ERemoteParam eRemoteParam) {
            ArrayList<ERemoteParam> arrayList = new ArrayList<>();
            try {
                for (String trim : getStringValueOf(eRemoteParam).split(PreferencesConstants.COOKIE_DELIMITER)) {
                    arrayList.add(ERemoteParam.stringOf(trim.trim()));
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return arrayList;
        }
    }

    public class ERemoteReasonResult extends ERemoteOperationResult {
        public ERemoteReasonResult(JSONObject jSONObject) {
            super(jSONObject);
        }

        public ERemoteParam reason() {
            return getParamValueOf(ERemoteParam.reason);
        }
    }

    class ERemoteRequest {
        IAHttpClient.HttpPost request;
        int timeout;

        public ERemoteRequest(String str, ArrayList<BasicNameValuePair> arrayList, int i) {
            try {
                this.request = new IAHttpClient.HttpPost(str);
                this.request.setContentEncoding(CharEncoding.UTF_8);
                this.request.setContentType(RequestParam.Content_Type.string);
                this.request.setEntity(IAHttpClient.HttpPost.getUrlEncodedFormEntity(arrayList, CharEncoding.UTF_8));
                this.timeout = i;
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }
        }

        public JSONObject execute() {
            try {
                Log.d("ERequest A", this.request.getURI().toString());
                ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                this.request.getEntity().writeTo(byteArrayOutputStream);
                Log.d("ERequest B", byteArrayOutputStream.toString());
                IAHttpClient iAHttpClient = new IAHttpClient();
                iAHttpClient.setConnectionTimeout(this.timeout);
                iAHttpClient.setSoTimeout(this.timeout);
                return ERemoteOperationResult.parseResponse(iAHttpClient.execute(this.request));
            } catch (Exception e) {
                e.printStackTrace();
                return new JSONObject();
            }
        }
    }

    static class ERemoteRequestBuilder extends ERemoteOperation {
        RequestParam command;
        ArrayList<BasicNameValuePair> messageBody = new ArrayList<>();
        RequestParam operation;
        HashMap<ERemoteParam, Object> remoteParam;
        StringBuffer requestURI;
        int timeout;
        RequestParam version;

        public interface VariantValueConverter {
            ERemoteParam convertValue(int i);
        }

        ERemoteRequestBuilder(String str, RequestParam requestParam, RequestParam requestParam2, RequestParam requestParam3, int i) {
            this.operation = requestParam;
            this.version = requestParam2;
            this.command = requestParam3;
            this.timeout = i;
            StringBuffer stringBuffer = new StringBuffer();
            stringBuffer.append(CommonDefine.SLASH);
            stringBuffer.append(RequestParam.remote_operation.string);
            stringBuffer.append(CommonDefine.SLASH);
            stringBuffer.append(requestParam2.string);
            stringBuffer.append(CommonDefine.SLASH);
            stringBuffer.append(requestParam.string);
            stringBuffer.append(CommonDefine.SLASH);
            stringBuffer.append(requestParam3.string);
            this.requestURI = new StringBuffer(IPAddressUtils.buildURL(RequestParam.HTTP.string, str, stringBuffer.toString()));
            this.remoteParam = new HashMap<>();
        }

        private void deleteLastCharIf(StringBuffer stringBuffer, char c) {
            if (stringBuffer.length() > 0) {
                int length = stringBuffer.length() - 1;
                if (stringBuffer.charAt(length) == c) {
                    stringBuffer.deleteCharAt(length);
                }
            }
        }

        public static ERemoteRequestBuilder requestDevice(String str, RequestParam requestParam, int i) {
            return new ERemoteRequestBuilder(str, RequestParam.device, RequestParam.v1, requestParam, i);
        }

        public static ERemoteRequestBuilder requestPrinter(String str, RequestParam requestParam, int i) {
            return new ERemoteRequestBuilder(str, RequestParam.printer, RequestParam.v1, requestParam, i);
        }

        public static ERemoteRequestBuilder requestScanner(String str, RequestParam requestParam, int i) {
            return new ERemoteRequestBuilder(str, RequestParam.scanner, RequestParam.v1, requestParam, i);
        }

        public static ERemoteRequestBuilder requestCopy(String str, RequestParam requestParam, int i) {
            return new ERemoteRequestBuilder(str, RequestParam.copy, RequestParam.v1, requestParam, i);
        }

        public static ERemoteRequestBuilder requestCopyPhoto(String str, RequestParam requestParam, int i) {
            return new ERemoteRequestBuilder(str, RequestParam.copy_photo, RequestParam.v1, requestParam, i);
        }

        public static ERemoteRequestBuilder requestCombo(String str, RequestParam requestParam, int i) {
            return new ERemoteRequestBuilder(str, RequestParam.combo, RequestParam.v1, requestParam, i);
        }

        public void add(ERemoteParam eRemoteParam, boolean z) {
            this.remoteParam.put(eRemoteParam, new Boolean(z));
            this.messageBody.add(new BasicNameValuePair(eRemoteParam.string, String.valueOf(z)));
        }

        public void add(ERemoteParam eRemoteParam, int i) {
            this.remoteParam.put(eRemoteParam, new Integer(i));
            this.messageBody.add(new BasicNameValuePair(eRemoteParam.string, String.valueOf(i)));
        }

        public void add(ERemoteParam eRemoteParam, int[] iArr) {
            this.remoteParam.put(eRemoteParam, Arrays.asList(new int[][]{iArr}));
            StringBuffer stringBuffer = new StringBuffer();
            for (int append : iArr) {
                stringBuffer.append(append);
                stringBuffer.append(PreferencesConstants.COOKIE_DELIMITER);
            }
            deleteLastCharIf(stringBuffer, ',');
            this.messageBody.add(new BasicNameValuePair(eRemoteParam.string, String.valueOf(stringBuffer)));
        }

        public void add(ERemoteParam eRemoteParam, String str) {
            if (!str.equals(ERemoteParam.x_null.string)) {
                this.remoteParam.put(eRemoteParam, str);
                this.messageBody.add(new BasicNameValuePair(eRemoteParam.string, str));
            }
        }

        public void add(ERemoteParam eRemoteParam, int i, VariantValueConverter variantValueConverter) {
            String valueOf = String.valueOf(i);
            ERemoteParam convertValue = variantValueConverter.convertValue(i);
            if (convertValue != null) {
                valueOf = convertValue.string;
            }
            this.remoteParam.put(eRemoteParam, valueOf);
            this.messageBody.add(new BasicNameValuePair(eRemoteParam.string, valueOf));
        }

        public void add(ERemoteParam eRemoteParam, ERemoteParam eRemoteParam2) {
            if (eRemoteParam2 != ERemoteParam.x_null) {
                this.remoteParam.put(eRemoteParam, eRemoteParam2);
                this.messageBody.add(new BasicNameValuePair(eRemoteParam.string, eRemoteParam2.string));
            }
        }

        public void add(ERemoteParam eRemoteParam, ArrayList<ERemoteParam> arrayList) {
            this.remoteParam.put(eRemoteParam, arrayList);
            StringBuffer stringBuffer = new StringBuffer();
            Iterator<ERemoteParam> it = arrayList.iterator();
            while (it.hasNext()) {
                stringBuffer.append(it.next().string);
                stringBuffer.append(PreferencesConstants.COOKIE_DELIMITER);
            }
            deleteLastCharIf(stringBuffer, ',');
            this.messageBody.add(new BasicNameValuePair(eRemoteParam.string, String.valueOf(stringBuffer)));
        }

        public void add(ERemoteParam eRemoteParam, List<String> list) {
            this.remoteParam.put(eRemoteParam, list);
            StringBuffer stringBuffer = new StringBuffer();
            for (String append : list) {
                stringBuffer.append(append);
                stringBuffer.append(PreferencesConstants.COOKIE_DELIMITER);
            }
            deleteLastCharIf(stringBuffer, ',');
            this.messageBody.add(new BasicNameValuePair(eRemoteParam.string, String.valueOf(stringBuffer)));
        }

        public ERemoteRequest getRemoteRequest() {
            return new ERemoteRequest(this.requestURI.toString(), this.messageBody, this.timeout);
        }
    }
}
