// Path: src/main/java/com/mpush/api/Constants.java
// public interface Constants {
//     Charset UTF_8 = Charset.forName("UTF-8");
// 
//     int DEFAULT_SO_TIMEOUT = 1000 * 3;//客户端连接超时时间
// 
//     int DEFAULT_WRITE_TIMEOUT = 1000 * 10;//10s默认packet写超时
// 
//     byte[] EMPTY_BYTES = new byte[0];
// 
//     int DEF_HEARTBEAT = 4 * 60 * 1000;//5min 默认心跳时间
// 
//     int DEF_COMPRESS_LIMIT = 1024;//1k 启用压缩阈值
// 
//     String DEF_OS_NAME = "android";//客户端OS
// 
//     int MAX_RESTART_COUNT = 10;//客户端重连次数超过该值，重连线程休眠10min后再重试
//     int MAX_TOTAL_RESTART_COUNT = 1000;//客户端重连次数超过该值，将不再尝试重连
// 
//     int MAX_HB_TIMEOUT_COUNT = 2;
// 
//     String HTTP_HEAD_READ_TIMEOUT = "readTimeout";
// }
// 
// Path: src/main/java/com/mpush/api/ack/AckContext.java
// public class AckContext {
//     public AckCallback callback;
//     public AckModel ackModel = AckModel.AUTO_ACK;
//     public int timeout = 1000;
//     public Packet request;
//     public int retryCount;
//     public RetryCondition retryCondition;
// 
//     public static AckContext build(AckCallback callback) {
//         AckContext context = new AckContext();
//         context.setCallback(callback);
//         return context;
//     }
// 
//     public AckCallback getCallback() {
//         return callback;
//     }
// 
//     public AckContext setCallback(AckCallback callback) {
//         this.callback = callback;
//         return this;
//     }
// 
//     public AckModel getAckModel() {
//         return ackModel;
//     }
// 
//     public AckContext setAckModel(AckModel ackModel) {
//         this.ackModel = ackModel;
//         return this;
//     }
// 
//     public int getTimeout() {
//         return timeout;
//     }
// 
//     public AckContext setTimeout(int timeout) {
//         this.timeout = timeout;
//         return this;
//     }
// 
//     public Packet getRequest() {
//         return request;
//     }
// 
//     public AckContext setRequest(Packet request) {
//         this.request = request;
//         return this;
//     }
// 
//     public int getRetryCount() {
//         return retryCount;
//     }
// 
//     public AckContext setRetryCount(int retryCount) {
//         this.retryCount = retryCount;
//         return this;
//     }
// 
//     public RetryCondition getRetryCondition() {
//         return retryCondition;
//     }
// 
//     public AckContext setRetryCondition(RetryCondition retryCondition) {
//         this.retryCondition = retryCondition;
//         return this;
//     }
// }
// 
// Path: src/main/java/com/mpush/api/ack/AckModel.java
// public enum AckModel {
//     NO_ACK((byte) 0),//不需要ACK
//     AUTO_ACK(Packet.FLAG_AUTO_ACK),//客户端收到消息后自动确认消息
//     BIZ_ACK(Packet.FLAG_BIZ_ACK);//由客户端业务自己确认消息是否到达
//     public final byte flag;
// 
//     AckModel(byte flag) {
//         this.flag = flag;
//     }
// }


import com.mpush.api.Constants;
import com.mpush.api.ack.AckContext;
import com.mpush.api.ack.AckModel;
/*
 * (C) Copyright 2015-2016 the original author or authors.
 *
 * 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.
 *
 * Contributors:
 *     ohun@live.cn (夜色)
 */

package com.mpush.api.push;


/**
 * Created by ohun on 16/10/13.
 *
 * @author ohun@live.cn (夜色)
 */
public final class PushContext extends AckContext {
    public byte[] content;

    public PushContext(byte[] content) {
        this.content = content;
    }

    public static PushContext build(byte[] content) {
        return new PushContext(content);
    }

    public static PushContext build(String content) {
// Path: src/main/java/com/mpush/api/Constants.java
// public interface Constants {
//     Charset UTF_8 = Charset.forName("UTF-8");
// 
//     int DEFAULT_SO_TIMEOUT = 1000 * 3;//客户端连接超时时间
// 
//     int DEFAULT_WRITE_TIMEOUT = 1000 * 10;//10s默认packet写超时
// 
//     byte[] EMPTY_BYTES = new byte[0];
// 
//     int DEF_HEARTBEAT = 4 * 60 * 1000;//5min 默认心跳时间
// 
//     int DEF_COMPRESS_LIMIT = 1024;//1k 启用压缩阈值
// 
//     String DEF_OS_NAME = "android";//客户端OS
// 
//     int MAX_RESTART_COUNT = 10;//客户端重连次数超过该值，重连线程休眠10min后再重试
//     int MAX_TOTAL_RESTART_COUNT = 1000;//客户端重连次数超过该值，将不再尝试重连
// 
//     int MAX_HB_TIMEOUT_COUNT = 2;
// 
//     String HTTP_HEAD_READ_TIMEOUT = "readTimeout";
// }
// 
// Path: src/main/java/com/mpush/api/ack/AckContext.java
// public class AckContext {
//     public AckCallback callback;
//     public AckModel ackModel = AckModel.AUTO_ACK;
//     public int timeout = 1000;
//     public Packet request;
//     public int retryCount;
//     public RetryCondition retryCondition;
// 
//     public static AckContext build(AckCallback callback) {
//         AckContext context = new AckContext();
//         context.setCallback(callback);
//         return context;
//     }
// 
//     public AckCallback getCallback() {
//         return callback;
//     }
// 
//     public AckContext setCallback(AckCallback callback) {
//         this.callback = callback;
//         return this;
//     }
// 
//     public AckModel getAckModel() {
//         return ackModel;
//     }
// 
//     public AckContext setAckModel(AckModel ackModel) {
//         this.ackModel = ackModel;
//         return this;
//     }
// 
//     public int getTimeout() {
//         return timeout;
//     }
// 
//     public AckContext setTimeout(int timeout) {
//         this.timeout = timeout;
//         return this;
//     }
// 
//     public Packet getRequest() {
//         return request;
//     }
// 
//     public AckContext setRequest(Packet request) {
//         this.request = request;
//         return this;
//     }
// 
//     public int getRetryCount() {
//         return retryCount;
//     }
// 
//     public AckContext setRetryCount(int retryCount) {
//         this.retryCount = retryCount;
//         return this;
//     }
// 
//     public RetryCondition getRetryCondition() {
//         return retryCondition;
//     }
// 
//     public AckContext setRetryCondition(RetryCondition retryCondition) {
//         this.retryCondition = retryCondition;
//         return this;
//     }
// }
// 
// Path: src/main/java/com/mpush/api/ack/AckModel.java
// public enum AckModel {
//     NO_ACK((byte) 0),//不需要ACK
//     AUTO_ACK(Packet.FLAG_AUTO_ACK),//客户端收到消息后自动确认消息
//     BIZ_ACK(Packet.FLAG_BIZ_ACK);//由客户端业务自己确认消息是否到达
//     public final byte flag;
// 
//     AckModel(byte flag) {
//         this.flag = flag;
//     }
// }


// Path: src/main/java/com/mpush/api/push/PushContext.java
import com.mpush.api.Constants;
import com.mpush.api.ack.AckContext;
import com.mpush.api.ack.AckModel;

/*
 * (C) Copyright 2015-2016 the original author or authors.
 *
 * 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.
 *
 * Contributors:
 *     ohun@live.cn (夜色)
 */

package com.mpush.api.push;


/**
 * Created by ohun on 16/10/13.
 *
 * @author ohun@live.cn (夜色)
 */
public final class PushContext extends AckContext {
    public byte[] content;

    public PushContext(byte[] content) {
        this.content = content;
    }

    public static PushContext build(byte[] content) {
        return new PushContext(content);
    }

    public static PushContext build(String content) {
        return new PushContext(content.getBytes(Constants.UTF_8));