// Path: src/main/java/com/upnext/blekit/util/L.java
// public class L {
// 
//     /**
//      * Set to true if you want to see debug messages associated with this library
//      */
//     public static final boolean DEBUG_ENABLED = false;
// 
//     private static final String APP_NAME = "BLEKIT";
// 
//     public static void d( String msg ) {
//         debug(  msg );
//     }
// 
//     public static void d( Object obj ) {
//         if( obj != null )
//             debug( obj.toString() );
//     }
// 
//     public static void e( String msg ) {
//         Log.e(APP_NAME, msg);
//     }
// 
//     public static void e( String msg, Exception e ) {
//         Log.e( APP_NAME, msg, e );
//     }
// 
//     private static void debug( String msg ) {
//         if( DEBUG_ENABLED ) {
//             StackTraceElement[] els = Thread.currentThread().getStackTrace();
//             String className = els[4].getClassName();
//             className = className.substring( className.lastIndexOf( "." )+1 );
//             Log.d( APP_NAME, "[" + className + "." + els[4].getMethodName() + "] " + msg );
//         }
//     }
// 
// }


import com.upnext.blekit.util.L;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.Map;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
                            L.d("[payload] " + payload);
                        }
                        OutputStreamWriter writer = new OutputStreamWriter(outputStream, "UTF-8");
                        writer.write(payload);
                        writer.close();
                    } finally {
                        outputStream.close();
                    }
                }
                InputStream input = null;
                try {
                    input = connection.getInputStream();
                } catch ( IOException e ) {
                    // workaround for Android HttpURLConnection ( IOException is thrown for 40x error codes ).
                    final int statusCode = httpConnection.getResponseCode();
                    if ( statusCode == -1 ) throw e;
                    return new Response<T>(Error.httpError(httpConnection.getResponseCode()) );
                }
                final int statusCode = httpConnection.getResponseCode();
                L.d("statusCode " + statusCode);
                if ( statusCode == HttpURLConnection.HTTP_OK ||
                        statusCode == HttpURLConnection.HTTP_CREATED ) {
                    try {
                        T value = null;
                        if ( clazz != Void.class ) {
                            if(LOG_RESPONSE || clazz == String.class) {
                                StringBuilder sb=new StringBuilder();
                                BufferedReader br = new BufferedReader(new InputStreamReader(input));
                                String read = br.readLine();
                                while(read != null) {
// Path: src/main/java/com/upnext/blekit/util/L.java
// public class L {
// 
//     /**
//      * Set to true if you want to see debug messages associated with this library
//      */
//     public static final boolean DEBUG_ENABLED = false;
// 
//     private static final String APP_NAME = "BLEKIT";
// 
//     public static void d( String msg ) {
//         debug(  msg );
//     }
// 
//     public static void d( Object obj ) {
//         if( obj != null )
//             debug( obj.toString() );
//     }
// 
//     public static void e( String msg ) {
//         Log.e(APP_NAME, msg);
//     }
// 
//     public static void e( String msg, Exception e ) {
//         Log.e( APP_NAME, msg, e );
//     }
// 
//     private static void debug( String msg ) {
//         if( DEBUG_ENABLED ) {
//             StackTraceElement[] els = Thread.currentThread().getStackTrace();
//             String className = els[4].getClassName();
//             className = className.substring( className.lastIndexOf( "." )+1 );
//             Log.d( APP_NAME, "[" + className + "." + els[4].getMethodName() + "] " + msg );
//         }
//     }
// 
// }


// Path: src/main/java/com/upnext/blekit/util/http/HttpClient.java
import com.upnext.blekit.util.L;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.Map;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;

                            L.d("[payload] " + payload);
                        }
                        OutputStreamWriter writer = new OutputStreamWriter(outputStream, "UTF-8");
                        writer.write(payload);
                        writer.close();
                    } finally {
                        outputStream.close();
                    }
                }
                InputStream input = null;
                try {
                    input = connection.getInputStream();
                } catch ( IOException e ) {
                    // workaround for Android HttpURLConnection ( IOException is thrown for 40x error codes ).
                    final int statusCode = httpConnection.getResponseCode();
                    if ( statusCode == -1 ) throw e;
                    return new Response<T>(Error.httpError(httpConnection.getResponseCode()) );
                }
                final int statusCode = httpConnection.getResponseCode();
                L.d("statusCode " + statusCode);
                if ( statusCode == HttpURLConnection.HTTP_OK ||
                        statusCode == HttpURLConnection.HTTP_CREATED ) {
                    try {
                        T value = null;
                        if ( clazz != Void.class ) {
                            if(LOG_RESPONSE || clazz == String.class) {
                                StringBuilder sb=new StringBuilder();
                                BufferedReader br = new BufferedReader(new InputStreamReader(input));
                                String read = br.readLine();
                                while(read != null) {
                                    sb.append(read);