// Path: src/org/httpkit/HttpUtils.java
// public static final String CONTENT_ENCODING = "content-encoding";
// 
// Path: src/org/httpkit/HttpUtils.java
// public static final String CONTENT_TYPE = "content-type";


import org.httpkit.*;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.ExecutorService;
import java.util.zip.GZIPInputStream;
import java.util.zip.Inflater;
import java.util.zip.InflaterInputStream;
import static org.httpkit.HttpUtils.CONTENT_ENCODING;
import static org.httpkit.HttpUtils.CONTENT_TYPE;
package org.httpkit.client;




class Handler implements Runnable {

    private final int status;
    private final Map<String, Object> headers;
    private final Object body;
    private final IResponseHandler handler;

    public Handler(IResponseHandler handler, int status, Map<String, Object> headers,
                   Object body) {
        this.handler = handler;
        this.status = status;
        this.headers = headers;
        this.body = body;
    }

    public Handler(IResponseHandler handler, Throwable e) {
        this(handler, 0, null, e);
    }

    public void run() {
        if (body instanceof Throwable) {
            handler.onThrowable((Throwable) body);
        } else {
            handler.onSuccess(status, headers, body);
        }
    }
}

/**
 * Accumulate all the response, call upper logic at once, for easy use
 */
public class RespListener implements IRespListener {

    private boolean isText() {
        if (status.getCode() == 200) {
// Path: src/org/httpkit/HttpUtils.java
// public static final String CONTENT_ENCODING = "content-encoding";
// 
// Path: src/org/httpkit/HttpUtils.java
// public static final String CONTENT_TYPE = "content-type";


// Path: src/org/httpkit/client/RespListener.java
import org.httpkit.*;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.ExecutorService;
import java.util.zip.GZIPInputStream;
import java.util.zip.Inflater;
import java.util.zip.InflaterInputStream;
import static org.httpkit.HttpUtils.CONTENT_ENCODING;
import static org.httpkit.HttpUtils.CONTENT_TYPE;

package org.httpkit.client;




class Handler implements Runnable {

    private final int status;
    private final Map<String, Object> headers;
    private final Object body;
    private final IResponseHandler handler;

    public Handler(IResponseHandler handler, int status, Map<String, Object> headers,
                   Object body) {
        this.handler = handler;
        this.status = status;
        this.headers = headers;
        this.body = body;
    }

    public Handler(IResponseHandler handler, Throwable e) {
        this(handler, 0, null, e);
    }

    public void run() {
        if (body instanceof Throwable) {
            handler.onThrowable((Throwable) body);
        } else {
            handler.onSuccess(status, headers, body);
        }
    }
}

/**
 * Accumulate all the response, call upper logic at once, for easy use
 */
public class RespListener implements IRespListener {

    private boolean isText() {
        if (status.getCode() == 200) {
            String type = HttpUtils.getStringValue(headers, CONTENT_TYPE);