// Path: java/src/main/java/com/cisco/pxgrid/samples/ise/StompSubscription.java
// public static interface Handler {
// 	void handle(StompFrame message);
// }


import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.text.ParseException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import javax.websocket.ClientEndpoint;
import javax.websocket.CloseReason;
import javax.websocket.Endpoint;
import javax.websocket.EndpointConfig;
import javax.websocket.MessageHandler;
import javax.websocket.Session;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.cisco.pxgrid.samples.ise.StompSubscription.Handler;
	private void send(StompFrame message) throws IOException {
		if (session != null) {
			ByteArrayOutputStream baos = new ByteArrayOutputStream();
			message.write(baos);
			// Send as binary
			session.getBasicRemote().sendBinary(ByteBuffer.wrap(baos.toByteArray()));
		}
	}

	public void waitForOpen() throws InterruptedException {
		synchronized (this) {
			while (session == null) {
				this.wait();
			}
		}
	}

	private void onStompMessage(StompFrame stomp) {
		switch (stomp.getCommand()) {
		case CONNECTED:
			String version = stomp.getHeader("version");
			logger.info("STOMP CONNECTED version={}", version);
			break;
		case RECEIPT:
			String receiptId = stomp.getHeader("receipt-id");
			logger.info("STOMP RECEIPT id={}", receiptId);
			break;
		case MESSAGE:
			String id = stomp.getHeader("subscription");
			StompSubscription subscription = mapOfIdToSubscription.get(id);
// Path: java/src/main/java/com/cisco/pxgrid/samples/ise/StompSubscription.java
// public static interface Handler {
// 	void handle(StompFrame message);
// }


// Path: java/src/main/java/com/cisco/pxgrid/samples/ise/StompPubsubClientEndpoint.java
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.text.ParseException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import javax.websocket.ClientEndpoint;
import javax.websocket.CloseReason;
import javax.websocket.Endpoint;
import javax.websocket.EndpointConfig;
import javax.websocket.MessageHandler;
import javax.websocket.Session;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.cisco.pxgrid.samples.ise.StompSubscription.Handler;

	private void send(StompFrame message) throws IOException {
		if (session != null) {
			ByteArrayOutputStream baos = new ByteArrayOutputStream();
			message.write(baos);
			// Send as binary
			session.getBasicRemote().sendBinary(ByteBuffer.wrap(baos.toByteArray()));
		}
	}

	public void waitForOpen() throws InterruptedException {
		synchronized (this) {
			while (session == null) {
				this.wait();
			}
		}
	}

	private void onStompMessage(StompFrame stomp) {
		switch (stomp.getCommand()) {
		case CONNECTED:
			String version = stomp.getHeader("version");
			logger.info("STOMP CONNECTED version={}", version);
			break;
		case RECEIPT:
			String receiptId = stomp.getHeader("receipt-id");
			logger.info("STOMP RECEIPT id={}", receiptId);
			break;
		case MESSAGE:
			String id = stomp.getHeader("subscription");
			StompSubscription subscription = mapOfIdToSubscription.get(id);
			Handler handler = subscription.getHandler();