// 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;
    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);
            if (type != null) {
                type = type.toLowerCase();
                // TODO may miss something
                return type.contains("text") || type.contains("json") || type.contains("xml");
            } else {
                return false;
            }
        } else {  // non 200: treat as text
            return true;
        }
    }

    private DynamicBytes unzipBody() throws IOException {
// 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;

    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);
            if (type != null) {
                type = type.toLowerCase();
                // TODO may miss something
                return type.contains("text") || type.contains("json") || type.contains("xml");
            } else {
                return false;
            }
        } else {  // non 200: treat as text
            return true;
        }
    }

    private DynamicBytes unzipBody() throws IOException {
        String encoding = HttpUtils.getStringValue(headers, CONTENT_ENCODING);