/*
 * Copyright 2015 Eric Liu
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.liuguangqiang.asyncokhttp;

import com.liuguangqiang.asyncokhttp.json.BaseJsonEngine;
import com.liuguangqiang.asyncokhttp.json.GsonEngine;
import com.liuguangqiang.asyncokhttp.json.LoganSquareEngine;

/**
 * Created by Eric on 15/6/11.
 */
public class Configuration {

    private BaseJsonEngine jsonEngine;
    private long connectTimeout;
    private long readTimeout;

    public BaseJsonEngine getJsonEngine() {
        return jsonEngine;
    }

    public void setJsonEngine(BaseJsonEngine jsonEngine) {
        this.jsonEngine = jsonEngine;
    }

    public long getConnectTimeout() {
        return connectTimeout;
    }

    public void setConnectTimeout(long connectTimeout) {
        this.connectTimeout = connectTimeout;
    }

    public long getReadTimeout() {
        return readTimeout;
    }

    public void setReadTimeout(long readTimeout) {
        this.readTimeout = readTimeout;
    }

    public Configuration(Builder builder) {
        jsonEngine = builder.jsonEngine;
        connectTimeout = builder.connectTimeout;
        readTimeout = builder.readTimeout;
    }

    public static class Builder {

        private BaseJsonEngine jsonEngine;
        private long connectTimeout;
        private long readTimeout;

        public Builder() {
            jsonEngine = new GsonEngine();
            connectTimeout = 30;
            readTimeout = 30;
        }

        public Builder jsonEngine(BaseJsonEngine jsonEngine) {
            this.jsonEngine = jsonEngine;
            return this;
        }

        public Builder connectTimeout(long connectTimeout) {
            this.connectTimeout = connectTimeout;
            return this;
        }

        public Builder readTimeout(long readTimeout) {
            this.readTimeout = readTimeout;
            return this;
        }

        public Configuration build() {
            return new Configuration(this);
        }

    }

}

@@ -753,56 +753,31 @@
 com.
-liuguangqiang.asyncokhttp.json.LoganSquareEngine
+squareup.okhttp.Headers
 ;%0A%0A/
@@ -941,24 +941,68 @@
 readTimeout;
+%0A    private Headers.Builder headersBuilder;
 %0A%0A    public
@@ -1519,32 +1519,240 @@
 Timeout;%0A    %7D%0A%0A
+    public Headers.Builder getHeadersBuilder() %7B%0A        return headersBuilder;%0A    %7D%0A%0A    public void setHeadersBuilder(Headers.Builder headersBuilder) %7B%0A        this.headersBuilder = headersBuilder;%0A    %7D%0A%0A
     public Confi
@@ -1904,32 +1904,176 @@
 er.readTimeout;%0A
+        headersBuilder = builder.headersBuilder;%0A    %7D%0A%0A    public static Configuration createDefault() %7B%0A        return new Builder().build();%0A
     %7D%0A%0A    publi
@@ -2211,16 +2211,64 @@
 Timeout;
+%0A        private Headers.Builder headersBuilder;
 %0A%0A      
@@ -2386,32 +2386,152 @@
 adTimeout = 30;%0A
+            headersBuilder = new Headers.Builder();%0A            headersBuilder.add(%22User-Agent%22, Constants.USER_AGENT);%0A
         %7D%0A%0A     
@@ -2860,32 +2860,32 @@
  readTimeout) %7B%0A
-
             this
@@ -2940,32 +2940,167 @@
 his;%0A        %7D%0A%0A
+        public Builder headers(Headers.Builder header) %7B%0A            this.headersBuilder = header;%0A            return this;%0A        %7D%0A%0A
         public C

Create a Headers.Builder with builder.