// Path: src/main/java/io/vantiq/client/SubscriptionCallback.java
// public interface SubscriptionCallback {
// 
//     /**
//      * Called once the connection has been established and the
//      * subscription has been acknowledged by the Vantiq server.
//      */
//     void onConnect();
// 
//     /**
//      * Called for every matching event that occurs
//      *
//      * @param message The information associated with the event
//      */
//     void onMessage(SubscriptionMessage message);
// 
//     /**
//      * Called whenever an error occurs that does not arise from
//      * an exception, such as if a non-success response is provided.
//      *
//      * @param error The error message
//      */
//     void onError(String error);
// 
//     /**
//      * Called whenever an exception occurs during the subscription
//      * processing.
//      *
//      * @param t The exception thrown
//      */
//     void onFailure(Throwable t);
// }
// 
// Path: src/main/java/io/vantiq/client/SubscriptionMessage.java
// public class SubscriptionMessage {
// 
//     private int status;
//     private String contentType;
//     private Map<String, String> headers;
//     private Object body;
// 
//     /**
//      * The HTTP status code for this message.  Usually, this is 100.
//      *
//      * @return The status code for the message
//      */
//     public int getStatus() {
//         return status;
//     }
// 
//     /**
//      * The content type for the body of the message.  Usually, this is
//      * application/json indicating the content was JSON encoded.
//      *
//      * @return The MIME type for the message body
//      */
//     public String getContentType() {
//         return contentType;
//     }
// 
//     /**
//      * The headers associated with the message.
//      *
//      * @return The headers for the message.
//      */
//     public Map<String, String> getHeaders() {
//         return headers;
//     }
// 
//     /**
//      * Returns the payload for the message.  For a JSON encoded
//      * message, this would be a Map.
//      *
//      * @return The body of the message.
//      */
//     public Object getBody() {
//         return body;
//     }
// 
//     public String toString() {
//         StringBuilder sb = new StringBuilder("SubscriptionMessage[\n");
//         sb.append("  status:").append(this.status).append('\n');
//         sb.append("  contentType:").append(this.contentType).append('\n');
//         sb.append("  headers:").append(this.headers).append('\n');
//         sb.append("  body:").append(this.body).append('\n');
//         sb.append(']');
//         return sb.toString();
//     }
// }


import io.vantiq.client.SubscriptionCallback;
import io.vantiq.client.SubscriptionMessage;
import okhttp3.*;
import okio.Buffer;
import okio.ByteString;
import org.jetbrains.annotations.NotNull;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.*;
package io.vantiq.client.internal;



/**
 * Internal class that manages subscriptions to a Vantiq server.
 */
public class VantiqSubscriber extends WebSocketListener {

    private VantiqSession                              session = null;
    private OkHttpClient                                client = null;
    private WebSocket                                webSocket = null;
    private VantiqSubscriberLifecycleListener lifecycleHandler = null;
    private boolean                                enablePings = false;
    private ScheduledExecutorService         scheduledExecutor = null;
    private ScheduledFuture                       pingerHandle = null;

    private boolean                            wsauthenticated = false;

// Path: src/main/java/io/vantiq/client/SubscriptionCallback.java
// public interface SubscriptionCallback {
// 
//     /**
//      * Called once the connection has been established and the
//      * subscription has been acknowledged by the Vantiq server.
//      */
//     void onConnect();
// 
//     /**
//      * Called for every matching event that occurs
//      *
//      * @param message The information associated with the event
//      */
//     void onMessage(SubscriptionMessage message);
// 
//     /**
//      * Called whenever an error occurs that does not arise from
//      * an exception, such as if a non-success response is provided.
//      *
//      * @param error The error message
//      */
//     void onError(String error);
// 
//     /**
//      * Called whenever an exception occurs during the subscription
//      * processing.
//      *
//      * @param t The exception thrown
//      */
//     void onFailure(Throwable t);
// }
// 
// Path: src/main/java/io/vantiq/client/SubscriptionMessage.java
// public class SubscriptionMessage {
// 
//     private int status;
//     private String contentType;
//     private Map<String, String> headers;
//     private Object body;
// 
//     /**
//      * The HTTP status code for this message.  Usually, this is 100.
//      *
//      * @return The status code for the message
//      */
//     public int getStatus() {
//         return status;
//     }
// 
//     /**
//      * The content type for the body of the message.  Usually, this is
//      * application/json indicating the content was JSON encoded.
//      *
//      * @return The MIME type for the message body
//      */
//     public String getContentType() {
//         return contentType;
//     }
// 
//     /**
//      * The headers associated with the message.
//      *
//      * @return The headers for the message.
//      */
//     public Map<String, String> getHeaders() {
//         return headers;
//     }
// 
//     /**
//      * Returns the payload for the message.  For a JSON encoded
//      * message, this would be a Map.
//      *
//      * @return The body of the message.
//      */
//     public Object getBody() {
//         return body;
//     }
// 
//     public String toString() {
//         StringBuilder sb = new StringBuilder("SubscriptionMessage[\n");
//         sb.append("  status:").append(this.status).append('\n');
//         sb.append("  contentType:").append(this.contentType).append('\n');
//         sb.append("  headers:").append(this.headers).append('\n');
//         sb.append("  body:").append(this.body).append('\n');
//         sb.append(']');
//         return sb.toString();
//     }
// }


// Path: src/main/java/io/vantiq/client/internal/VantiqSubscriber.java
import io.vantiq.client.SubscriptionCallback;
import io.vantiq.client.SubscriptionMessage;
import okhttp3.*;
import okio.Buffer;
import okio.ByteString;
import org.jetbrains.annotations.NotNull;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.*;

package io.vantiq.client.internal;



/**
 * Internal class that manages subscriptions to a Vantiq server.
 */
public class VantiqSubscriber extends WebSocketListener {

    private VantiqSession                              session = null;
    private OkHttpClient                                client = null;
    private WebSocket                                webSocket = null;
    private VantiqSubscriberLifecycleListener lifecycleHandler = null;
    private boolean                                enablePings = false;
    private ScheduledExecutorService         scheduledExecutor = null;
    private ScheduledFuture                       pingerHandle = null;

    private boolean                            wsauthenticated = false;

    private Map<String,SubscriptionCallback>         callbacks = new HashMap<String,SubscriptionCallback>();