/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  org.apache.commons.httpclient.HttpClient
 */
package com.hst.httpclient;

import com.hst.httpclient.HttpConstants;
import org.apache.commons.httpclient.HttpClient;

public class HttpConnectionManager {
    public static String CHARSET_UTF = "UTF-8";

    public static HttpClient httpClientInstance() throws Exception {
        HttpClient client = new HttpClient();
        client.getHostConfiguration().setHost(HttpConstants.HTTP_IP, HttpConstants.HTTP_PORT, "http");
        client.getParams().setCookiePolicy("compatibility");
        client.getParams().setContentCharset(CHARSET_UTF);
        int timeout = HttpConstants.HTTP_CONNECTION_TIMEOUT > 0 ? HttpConstants.HTTP_CONNECTION_TIMEOUT : 60000;
        client.getHttpConnectionManager().getParams().setConnectionTimeout(timeout);
        return client;
    }

    public static HttpClient httpClientInstance(String ip, int port, String charset, int timeout) throws Exception {
        HttpClient client = new HttpClient();
        client.getHostConfiguration().setHost(ip, port, "http");
        client.getParams().setCookiePolicy("compatibility");
        client.getParams().setContentCharset(charset);
        client.getHttpConnectionManager().getParams().setConnectionTimeout(timeout);
        return client;
    }
}
