[Demonstration 1]

[Buggy Method]
public static OkHttpClient clientWithProxy(OkHttpClient oldClient) {
    // 对于socks代理 new Proxy(SOCKS, ...) 不起作用
    // 得用socketFactory 可能是aosp的bug
    Proxy httpProxy = new Proxy(Proxy.Type.HTTP, InetSocketAddress.createUnresolved(ProxyUtil.FIDDLER_PROXY_IP_INNER, ProxyUtil.FIDDLER_PROXY_PORT_INNER));
    return oldClient.newBuilder().proxy(httpProxy).//                .socketFactory(new ProxySocketFactory())
    authenticator(new OkAuthenticator()).addInterceptor(new LoggingInterceptor()).build();
}

[Buggy Hunk]
.authenticator(new OkAuthenticator())

[Patch]
.proxyAuthenticator(new OkProxyAuthenticator())

[Demonstration 2]

[Buggy Method]
@Override
public void connectionAcquired(BackendConnection conn) {
    conn.setResponseHandler(this);
    try {
        conn.query(((SequnceVal) conn.getAttachment()).sql);
    } catch (Exception e) {
        executeException(conn, e);
    }
}

[Buggy Hunk]
conn.query(((SequnceVal) conn.getAttachment()).sql);

[Patch]
conn.query(((SequenceVal) conn.getAttachment()).sql);

[Demonstration 3]

[Buggy Method]
private static String processFileRequest(URL fileUrl, boolean authn, String userpassword, String authnOther, String method, String locale, String accept, String content, String contentType, boolean compress, String customHeaderName, String customHeaderValue) throws IOException {
    InputStream is = null;
    String file = null;
    long start = System.currentTimeMillis();
    try {
        HttpURLConnection conn = (HttpURLConnection) fileUrl.openConnection();
        conn.setRequestMethod(method);
        conn.setConnectTimeout(timeoutMs);
        conn.setReadTimeout(timeoutMs);
        conn.setRequestProperty("User-Agent", "http://www.gms-world.net HTTP client");
        if (authn && userpassword != null) {
            //username : password
            String encodedAuthorization = Base64.encode(userpassword.getBytes());
            conn.setRequestProperty("Authorization", "Basic " + encodedAuthorization);
        } else if (authn && authnOther != null) {
            conn.setRequestProperty("Authorization", authnOther);
        }
        if (StringUtils.isNotEmpty(locale)) {
            conn.setRequestProperty("Accept-Language", locale);
        }
        conn.setRequestProperty("Accept-Charset", "utf-8");
        if (StringUtils.isNotEmpty(accept)) {
            conn.setRequestProperty("Accept", accept);
        }
        if (StringUtils.isNotEmpty(customHeaderName) && StringUtils.isNotEmpty(customHeaderValue)) {
            conn.setRequestProperty(customHeaderName, customHeaderValue);
        }
        if (content != null) {
            conn.setRequestProperty("Content-Length", Integer.toString(content.getBytes().length));
            //conn.setRequestProperty("Content-Language", "en-US");
            if (contentType != null) {
                conn.setRequestProperty("Content-Type", contentType);
            } else {
                conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
            }
            if (compress) {
                conn.setRequestProperty("Accept-Encoding", "gzip, deflate");
            }
            conn.setDoInput(true);
            conn.setDoOutput(true);
            //Send request
            IOUtils.write(content, conn.getOutputStream());
        } else {
            conn.connect();
        }
        int responseCode = conn.getResponseCode();
        httpResponseStatuses.put(fileUrl.toExternalForm(), responseCode);
        if (responseCode == HttpServletResponse.SC_OK) {
            is = conn.getInputStream();
            logger.log(Level.INFO, "Received http status code {0} for url {1}", new Object[] { responseCode, fileUrl.toString() });
        } else if (responseCode >= 400) {
            is = conn.getErrorStream();
            logger.log(Level.SEVERE, "Received http status code {0} for url {1}", new Object[] { responseCode, fileUrl.toString() });
        } else if (responseCode >= 300 && responseCode < 400) {
            logger.log(Level.WARNING, "Received http status code {0} for url {1}", new Object[] { responseCode, fileUrl.toString() });
        } else if (responseCode > 200) {
            logger.log(Level.INFO, "Received http status code {0} for url {1}", new Object[] { responseCode, fileUrl.toString() });
        }
        if (responseCode != HttpServletResponse.SC_NO_CONTENT && is != null) {
            file = IOUtils.toString(is, "UTF-8");
            int length = file.length();
            if (length > 0) {
                logger.log(Level.INFO, "Received " + conn.getContentType() + " document having " + length + " characters");
            }
        }
        logger.log(Level.INFO, "Request with status " + responseCode + " processed in " + (System.currentTimeMillis() - start) + " millis.");
    } catch (Exception e) {
        logger.log(Level.SEVERE, e.getMessage(), e);
        //httpResponseStatuses.remove(fileUrl.toExternalForm());
    } finally {
        if (is != null) {
            is.close();
        }
    }
    return file;
}

[Buggy Hunk]
IOUtils.write(content, conn.getOutputStream());

[Patch]
IOUtils.write(content, conn.getOutputStream(), Charset.forName("UTF-8"));