// Path: src/main/java/io/stalk/common/oauth/exception/SocialAuthException.java
// public class SocialAuthException extends Exception {
// 
//     /**
//      *
//      */
//     private static final long serialVersionUID = -6856436294292027306L;
// 
//     public SocialAuthException() {
//         super();
//     }
// 
//     public SocialAuthException(final String message) {
//         super(message);
//     }
// 
//     public SocialAuthException(final Throwable cause) {
//         super(cause);
//     }
// 
//     public SocialAuthException(final String message, final Throwable cause) {
//         super(message, cause);
//     }
// }


import io.stalk.common.oauth.exception.SocialAuthException;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
package io.stalk.common.oauth.utils;



public class HttpUtil {

    private static int timeoutValue = 0;

    public static void setConnectionTimeout(final int timeout) {
        timeoutValue = timeout;
    }

    public static String encodeURIComponent(final String value)
            throws Exception {
        if (value == null) {
            return "";
        }

        try {
            return URLEncoder.encode(value, "utf-8")
                    // OAuth encodes some characters differently:
                    .replace("+", "%20").replace("*", "%2A")
                    .replace("%7E", "~");
            // This could be done faster with more hand-crafted code.
        } catch (UnsupportedEncodingException wow) {
// Path: src/main/java/io/stalk/common/oauth/exception/SocialAuthException.java
// public class SocialAuthException extends Exception {
// 
//     /**
//      *
//      */
//     private static final long serialVersionUID = -6856436294292027306L;
// 
//     public SocialAuthException() {
//         super();
//     }
// 
//     public SocialAuthException(final String message) {
//         super(message);
//     }
// 
//     public SocialAuthException(final Throwable cause) {
//         super(cause);
//     }
// 
//     public SocialAuthException(final String message, final Throwable cause) {
//         super(message, cause);
//     }
// }


// Path: src/main/java/io/stalk/common/oauth/utils/HttpUtil.java
import io.stalk.common.oauth.exception.SocialAuthException;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;

package io.stalk.common.oauth.utils;



public class HttpUtil {

    private static int timeoutValue = 0;

    public static void setConnectionTimeout(final int timeout) {
        timeoutValue = timeout;
    }

    public static String encodeURIComponent(final String value)
            throws Exception {
        if (value == null) {
            return "";
        }

        try {
            return URLEncoder.encode(value, "utf-8")
                    // OAuth encodes some characters differently:
                    .replace("+", "%20").replace("*", "%2A")
                    .replace("%7E", "~");
            // This could be done faster with more hand-crafted code.
        } catch (UnsupportedEncodingException wow) {
            throw new SocialAuthException(wow.getMessage(), wow);