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

    }

    public void startPeriodicPings() {
        this.pingerHandle =
            this.scheduledExecutor.scheduleAtFixedRate(new WebSockerPinger(),
                                                       0, 30, TimeUnit.SECONDS);
    }

    @Override
    public void onOpen(WebSocket webSocket, Response response) {
        this.webSocket = webSocket;
        //
        // Once the socket is open, we first need to validate the token
        // to create an authenticated session
        //
        ValidateAuthenticationRequest request =
            new ValidateAuthenticationRequest(this.session.getAccessToken());
        String body = VantiqSession.gson.toJson(request);
        this.webSocket.send(body);
    }

    @Override
    public void onFailure(@NotNull WebSocket webSocket, @NotNull Throwable t, Response response) {
        this.lifecycleHandler.onFailure(t);
    }

    @Override
    public void onMessage(@NotNull WebSocket webSocket, ByteString bodyBytes) {
        String bodyStr = bodyBytes.utf8();
// 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.*;


    }

    public void startPeriodicPings() {
        this.pingerHandle =
            this.scheduledExecutor.scheduleAtFixedRate(new WebSockerPinger(),
                                                       0, 30, TimeUnit.SECONDS);
    }

    @Override
    public void onOpen(WebSocket webSocket, Response response) {
        this.webSocket = webSocket;
        //
        // Once the socket is open, we first need to validate the token
        // to create an authenticated session
        //
        ValidateAuthenticationRequest request =
            new ValidateAuthenticationRequest(this.session.getAccessToken());
        String body = VantiqSession.gson.toJson(request);
        this.webSocket.send(body);
    }

    @Override
    public void onFailure(@NotNull WebSocket webSocket, @NotNull Throwable t, Response response) {
        this.lifecycleHandler.onFailure(t);
    }

    @Override
    public void onMessage(@NotNull WebSocket webSocket, ByteString bodyBytes) {
        String bodyStr = bodyBytes.utf8();
        SubscriptionMessage msg =