// Path: src/main/java/com/mpush/api/Client.java
// public interface Client extends MPushProtocol {
// 
//     void start();
// 
//     void stop();
// 
//     void destroy();
// 
//     boolean isRunning();
// 
//     void onNetStateChange(boolean isConnected);
// 
// }
// 
// Path: src/main/java/com/mpush/api/ClientListener.java
// public interface ClientListener {
// 
//     void onConnected(Client client);
// 
//     void onDisConnected(Client client);
// 
//     void onHandshakeOk(Client client, int heartbeat);
// 
//     void onReceivePush(Client client, byte[] content, int messageId);
// 
//     void onKickUser(String deviceId, String userId);
// 
//     void onBind(boolean success, String userId);
// 
//     void onUnbind(boolean success, String userId);
// }
// 
// Path: src/main/java/com/mpush/util/DefaultLogger.java
// public final class DefaultLogger implements Logger {
//     private static final String TAG = "[mpush] ";
//     private final DateFormat format = new SimpleDateFormat("HH:mm:ss.SSS");
// 
//     private boolean enable = false;
// 
//     @Override
//     public void enable(boolean enabled) {
//         this.enable = enabled;
//     }
// 
//     @Override
//     public void d(String s, Object... args) {
//         if (enable) {
//             System.out.printf(format.format(new Date()) + " [D] " + TAG + s + '\n', args);
//         }
//     }
// 
//     @Override
//     public void i(String s, Object... args) {
//         if (enable) {
//             System.out.printf(format.format(new Date()) + " [I] " + TAG + s + '\n', args);
//         }
//     }
// 
//     @Override
//     public void w(String s, Object... args) {
//         if (enable) {
//             System.err.printf(format.format(new Date()) + " [W] " + TAG + s + '\n', args);
//         }
//     }
// 
//     @Override
//     public void e(Throwable e, String s, Object... args) {
//         if (enable) {
//             System.err.printf(format.format(new Date()) + " [E] " + TAG + s + '\n', args);
//             e.printStackTrace();
//         }
//     }
// 
// }


import com.mpush.api.Client;
import com.mpush.api.ClientListener;
import com.mpush.util.DefaultLogger;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/*
 * (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.client;




/**
 * Created by ohun on 2016/1/25.
 *
 * @author ohun@live.cn (夜色)
 */
public class MPushClientTest {
    private static final String publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCghPCWCobG8nTD24juwSVataW7iViRxcTkey/B792VZEhuHjQvA3cAJgx2Lv8GnX8NIoShZtoCg3Cx6ecs+VEPD2fBcg2L4JK7xldGpOJ3ONEAyVsLOttXZtNXvyDZRijiErQALMTorcgi79M5uVX9/jMv2Ggb2XAeZhlLD28fHwIDAQAB";
    private static final String allocServer = "http://103.60.220.145:9999/";

    public static void main(String[] args) throws Exception {
        int count = 1;
        String serverHost = "127.0.0.1";
        int sleep = 1000;

        if (args != null && args.length > 0) {
            count = Integer.parseInt(args[0]);
            if (args.length > 1) {
                serverHost = args[1];
            }
            if (args.length > 2) {
                sleep = Integer.parseInt(args[1]);
            }
        }

        ScheduledExecutorService scheduledExecutor = Executors.newSingleThreadScheduledExecutor();
// Path: src/main/java/com/mpush/api/Client.java
// public interface Client extends MPushProtocol {
// 
//     void start();
// 
//     void stop();
// 
//     void destroy();
// 
//     boolean isRunning();
// 
//     void onNetStateChange(boolean isConnected);
// 
// }
// 
// Path: src/main/java/com/mpush/api/ClientListener.java
// public interface ClientListener {
// 
//     void onConnected(Client client);
// 
//     void onDisConnected(Client client);
// 
//     void onHandshakeOk(Client client, int heartbeat);
// 
//     void onReceivePush(Client client, byte[] content, int messageId);
// 
//     void onKickUser(String deviceId, String userId);
// 
//     void onBind(boolean success, String userId);
// 
//     void onUnbind(boolean success, String userId);
// }
// 
// Path: src/main/java/com/mpush/util/DefaultLogger.java
// public final class DefaultLogger implements Logger {
//     private static final String TAG = "[mpush] ";
//     private final DateFormat format = new SimpleDateFormat("HH:mm:ss.SSS");
// 
//     private boolean enable = false;
// 
//     @Override
//     public void enable(boolean enabled) {
//         this.enable = enabled;
//     }
// 
//     @Override
//     public void d(String s, Object... args) {
//         if (enable) {
//             System.out.printf(format.format(new Date()) + " [D] " + TAG + s + '\n', args);
//         }
//     }
// 
//     @Override
//     public void i(String s, Object... args) {
//         if (enable) {
//             System.out.printf(format.format(new Date()) + " [I] " + TAG + s + '\n', args);
//         }
//     }
// 
//     @Override
//     public void w(String s, Object... args) {
//         if (enable) {
//             System.err.printf(format.format(new Date()) + " [W] " + TAG + s + '\n', args);
//         }
//     }
// 
//     @Override
//     public void e(Throwable e, String s, Object... args) {
//         if (enable) {
//             System.err.printf(format.format(new Date()) + " [E] " + TAG + s + '\n', args);
//             e.printStackTrace();
//         }
//     }
// 
// }


// Path: src/test/java/com/mpush/client/MPushClientTest.java
import com.mpush.api.Client;
import com.mpush.api.ClientListener;
import com.mpush.util.DefaultLogger;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/*
 * (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.client;




/**
 * Created by ohun on 2016/1/25.
 *
 * @author ohun@live.cn (夜色)
 */
public class MPushClientTest {
    private static final String publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCghPCWCobG8nTD24juwSVataW7iViRxcTkey/B792VZEhuHjQvA3cAJgx2Lv8GnX8NIoShZtoCg3Cx6ecs+VEPD2fBcg2L4JK7xldGpOJ3ONEAyVsLOttXZtNXvyDZRijiErQALMTorcgi79M5uVX9/jMv2Ggb2XAeZhlLD28fHwIDAQAB";
    private static final String allocServer = "http://103.60.220.145:9999/";

    public static void main(String[] args) throws Exception {
        int count = 1;
        String serverHost = "127.0.0.1";
        int sleep = 1000;

        if (args != null && args.length > 0) {
            count = Integer.parseInt(args[0]);
            if (args.length > 1) {
                serverHost = args[1];
            }
            if (args.length > 2) {
                sleep = Integer.parseInt(args[1]);
            }
        }

        ScheduledExecutorService scheduledExecutor = Executors.newSingleThreadScheduledExecutor();
        ClientListener listener = new L(scheduledExecutor);