public class UC01Handler extends AbstractHandler {
	// "test connecting the socket and disconnecting"

	@Override
	public void onConnect(final SocketIOOutbound outbound, final SocketIOSessionEventRegister eventRegister,
			final SocketIOSessionNSRegister NSRegister) {
		outbound.disconnect();
	}
} public class UC02Handler extends AbstractHandler {
	private static final Logger LOGGER = Logger.getLogger(UC02Handler.class);

	// 'test receiving messages'

	@Override
	public void onConnect(final SocketIOOutbound outbound, final SocketIOSessionEventRegister eventRegister,
			final SocketIOSessionNSRegister NSRegister) {

		new Thread(new Runnable() {
			int messages = 0;

			@Override
			public void run() {
				try {
					do {
						Thread.sleep(50);
						outbound.sendMessage(String.valueOf(++messages), null);
					} while (messages < 3);
					Thread.sleep(500);
					outbound.disconnect();
				} catch (Exception e) {
					LOGGER.fatal(e);
				}
			}
		}).start();
	}
} public class UC03Handler extends AbstractHandler {
	private static final Logger LOGGER = Logger.getLogger(UC03Handler.class);

	// 'test sending messages'

	SocketIOOutbound outbound;

	@Override
	public void onConnect(final SocketIOOutbound outbound, final SocketIOSessionEventRegister eventRegister,
			final SocketIOSessionNSRegister NSRegister) {
		this.outbound = outbound;
	}

	@Override
	public void onMessage(final long messageID, final String endPoint, final String message) {
		try {
			outbound.sendMessage(message, null);
		} catch (SocketIOException e) {
			LOGGER.fatal(e);
		}
	}
} public class UC04Handler extends AbstractHandler {
	private static final Logger LOGGER = Logger.getLogger(UC03Handler.class);

	// 'test acks sent from client'

	SocketIOOutbound outbound;

	@Override
	public void onConnect(final SocketIOOutbound outbound, final SocketIOSessionEventRegister eventRegister,
			final SocketIOSessionNSRegister NSRegister) {
		this.outbound = outbound;
		try {
			outbound.sendMessage("tobi", null, new AckHandler() {
				@Override
				public void onEvent(String data) {
					try {
						outbound.sendMessage("tobi 2", null);
					} catch (SocketIOException e) {
						LOGGER.fatal(e);
					}
				}
			});
		} catch (SocketIOException e) {
			LOGGER.fatal(e);
		}
	}
} public class UC05Handler extends AbstractHandler {
	// 'test acks sent from server'

	@Override
	public void onConnect(final SocketIOOutbound outbound, final SocketIOSessionEventRegister eventRegister,
			final SocketIOSessionNSRegister NSRegister) {
	}
} public class UC06Handler extends AbstractHandler {
	private static final Logger LOGGER = Logger.getLogger(UC05Handler.class);

	// 'test connecting to namespaces'

	@Override
	public void onConnect(final SocketIOOutbound outbound, final SocketIOSessionEventRegister eventRegister,
			final SocketIOSessionNSRegister NSRegister) {
		NSRegister.registerNSListeners("/woot", new SocketIONSHandler() {
			@Override
			public void onMessage(long messageID, String message) {
			}

			@Override
			public void onJSONMessage(long messageID, String message) {
			}

			@Override
			public void onError(String reason, String advice) {
			}

			@Override
			public void onDisconnect(DisconnectReason reason, String errorMessage) {
			}

			@Override
			public void onConnect(SocketIOOutbound outbound) {
				try {
					outbound.sendMessage("connected to woot", "/woot");
				} catch (SocketIOException e) {
					LOGGER.fatal(e);
				}
			}
		});

		NSRegister.registerNSListeners("/chat", new SocketIONSHandler() {
			@Override
			public void onMessage(long messageID, String message) {
			}

			@Override
			public void onJSONMessage(long messageID, String message) {
			}

			@Override
			public void onError(String reason, String advice) {
			}

			@Override
			public void onDisconnect(DisconnectReason reason, String errorMessage) {
			}

			@Override
			public void onConnect(SocketIOOutbound outbound) {
				try {
					outbound.sendMessage("connected to chat", "/chat");
				} catch (SocketIOException e) {
					LOGGER.fatal(e);
				}
			}
		});
	}
} public class UC07Handler extends AbstractHandler {
	// 'test disconnecting from namespaces'

	public void onConnect(final SocketIOOutbound outbound, final SocketIOSessionEventRegister eventRegister,
			final SocketIOSessionNSRegisterImpl NSRegister) {
	}
} public class UC08Handler extends AbstractHandler {
	// 'test authorizing for namespaces'
} public class UC09Handler extends AbstractHandler {
	private static final Logger LOGGER = Logger.getLogger(UC11Handler.class);

	// 'test sending json from server'

	@Override
	public void onConnect(final SocketIOOutbound outbound, final SocketIOSessionEventRegister eventRegister,
			final SocketIOSessionNSRegister NSRegister) {
		try {
			outbound.sendJSONMessage("3141592", null);
		} catch (SocketIOException e) {
			LOGGER.fatal(e);
		}
	}
} public class UC10Handler extends AbstractHandler {
	private static final Logger LOGGER = Logger.getLogger(UC09Handler.class);

	// 'test sending json from client'

	private SocketIOOutbound outbound;

	@Override
	public void onConnect(final SocketIOOutbound outbound, final SocketIOSessionEventRegister eventRegister,
			final SocketIOSessionNSRegister NSRegister) {
		this.outbound = outbound;
	}

	@Override
	public void onJSONMessage(long messageID, String endPoint, String message) {
		if ("[1,2,3]".equals(message)) {
			try {
				outbound.sendMessage("echo", null);
			} catch (SocketIOException e) {
				LOGGER.fatal(e);
			}
		}
	}
} public class UC11Handler extends AbstractHandler {
	private static final Logger LOGGER = Logger.getLogger(UC11Handler.class);

	// 'test emitting an event from server'

	@Override
	public void onConnect(final SocketIOOutbound outbound, final SocketIOSessionEventRegister eventRegister,
			final SocketIOSessionNSRegister NSRegister) {
		try {
			outbound.sendEventMessage("woot", "", null);
		} catch (SocketIOException e) {
			LOGGER.fatal(e);
		}
	}

} public class UC12Handler extends AbstractHandler {
	private static final Logger LOGGER = Logger.getLogger(UC12Handler.class);

	// 'test emitting multiple events at once to the server'

	@Override
	public void onConnect(final SocketIOOutbound outbound, final SocketIOSessionEventRegister eventRegister,
			final SocketIOSessionNSRegister NSRegister) {
		eventRegister.registerEventListeners("print", new SocketIOEventHandler() {
			List<String> messages = new ArrayList<String>();

			@Override
			public void onEvent(long messageID, String endPoint, String data) {
				if (messages.contains(data)) {
					LOGGER.fatal("Duplicate message");
				}
				messages.add(data);
				if (messages.size() == 2) {
					try {
						outbound.sendEventMessage("done", "", null);
					} catch (SocketIOException e) {
						LOGGER.fatal(e);
					}
				}
			}
		});
	}
} public class UC13Handler extends AbstractHandler {
	private static final Logger LOGGER = Logger.getLogger(UC13Handler.class);

	// 'test emitting an event to server'

	@Override
	public void onConnect(final SocketIOOutbound outbound, final SocketIOSessionEventRegister eventRegister,
			final SocketIOSessionNSRegister NSRegister) {
		eventRegister.registerEventListeners("woot", new SocketIOEventHandler() {
			@Override
			public void onEvent(long messageID, String endPoint, String data) {
				try {
					outbound.sendEventMessage("echo", "", null);
				} catch (SocketIOException e) {
					LOGGER.fatal(e);
				}
			}
		});
	}

} public class UC14Handler extends AbstractHandler {
	private static final Logger LOGGER = Logger.getLogger(UC14Handler.class);

	// 'test emitting an event from server and sending back data'

	@Override
	public void onConnect(final SocketIOOutbound outbound, final SocketIOSessionEventRegister eventRegister,
			final SocketIOSessionNSRegister NSRegister) {
		try {
			outbound.sendEventMessage("woot", "1", null, new AckHandler() {
				@Override
				public void onEvent(String data) {
					try {
						if ("[\"test\"]".equals(data))
							outbound.sendEventMessage("done", "", null);
					} catch (SocketIOException e) {
						LOGGER.fatal(e);
					}
				}
			});
		} catch (SocketIOException e) {
			LOGGER.fatal(e);
		}
	}
} public class UC15Handler extends AbstractHandler {
	private static final Logger LOGGER = Logger.getLogger(UC15Handler.class);

	// 'test emitting an event to server and sending back data'

	@Override
	public void onConnect(final SocketIOOutbound outbound, final SocketIOSessionEventRegister eventRegister,
			final SocketIOSessionNSRegister NSRegister) {
		eventRegister.registerEventListeners("tobi", new SocketIOEventHandler() {
			@Override
			public void onEvent(long messageID, String endPoint, String data) {
				if ("1,2".equals(data)) {
					try {
						outbound.sendAck(messageID, "[{\"hello\":\"world\"}]");
					} catch (SocketIOException e) {
						LOGGER.fatal(e);
					}
				}
				System.out.println(data);
			}
		});
	}
} public class UC16Handler extends AbstractHandler {
	private static final Logger LOGGER = Logger.getLogger(UC17Handler.class);
	
	private static String text;

	static {
		final byte [] b2 = {(byte) 0xC3, (byte) 0xB1}; // \uC3B1
		try {
			text = new String(b2, "UTF8");
		} catch (UnsupportedEncodingException e) {
			LOGGER.fatal(e);
		}
	}

	@Override
	public void onConnect(final SocketIOOutbound outbound, final SocketIOSessionEventRegister eventRegister,
			final SocketIOSessionNSRegister NSRegister) {
		NSRegister.registerNSListeners("/woot", new SocketIONSHandler() {
			int count = 0;

			@Override
			public void onMessage(long messageID, String message) {
				if (text.equals(message)) {
					if (++count == 4) {
						try {
							outbound.sendEventMessage("done", "", "/woot");
						} catch (SocketIOException e) {
							LOGGER.fatal(e);
						}
					}
				}
			}

			@Override
			public void onJSONMessage(long messageID, String message) {
			}

			@Override
			public void onError(String reason, String advice) {
			}

			@Override
			public void onDisconnect(DisconnectReason reason, String errorMessage) {
			}

			@Override
			public void onConnect(SocketIOOutbound outbound) {
			}
		});
	}
} public class UC17Handler extends AbstractHandler {
	private static final Logger LOGGER = Logger.getLogger(UC17Handler.class);

	// 'test sending query strings to the server'
	private String URI;

	@Override
	public boolean validate(final String URI) {
		this.URI = URI;
		return true;
	}

	@Override
	public void onConnect(final SocketIOOutbound outbound, final SocketIOSessionEventRegister eventRegister,
			final SocketIOSessionNSRegister NSRegister) {
		try {
			final QueryStringDecoder dec = new QueryStringDecoder(URI);
			final Map<String, List<String>> params = dec.getParameters();
			final String foo = params.get("foo").get(0);
			outbound.sendJSONMessage("{\"query\":{\"foo\":\"" + foo + "\"}}", null);
		} catch (SocketIOException e) {
			LOGGER.fatal(e);
		}
	}
} public class UC18Handler extends AbstractHandler {
	private static final Logger LOGGER = Logger.getLogger(UC19Handler.class);

	// 'test sending newline'

	SocketIOOutbound outbound;

	@Override
	public void onConnect(final SocketIOOutbound outbound, final SocketIOSessionEventRegister eventRegister,
			final SocketIOSessionNSRegister NSRegister) {
		this.outbound = outbound;
	}

	@Override
	public void onMessage(final long messageID, final String endPoint, final String message) {
		System.out.println("Message: '" + message + "' [" + message.getBytes() + "]");
		if ("\n".equals(message)) {
			try {
				outbound.sendEventMessage("done", "", null);
			} catch (SocketIOException e) {
				LOGGER.fatal(e);
			}
		}
	}
} public class UC19Handler extends AbstractHandler {
	private static final Logger LOGGER = Logger.getLogger(UC19Handler.class);

	// 'test sending unicode'

	SocketIOOutbound outbound;

	@Override
	public void onConnect(final SocketIOOutbound outbound, final SocketIOSessionEventRegister eventRegister,
			final SocketIOSessionNSRegister NSRegister) {
		this.outbound = outbound;
	}

	@Override
	public void onJSONMessage(final long messageID, final String endPoint, final String message) {
		System.out.println("Message: '" + message + "' [" + message.getBytes() + "]");
		if ("{\"test\":\"\u2028\"}".equals(message)) {
			try {
				outbound.sendEventMessage("done", "", null);
			} catch (SocketIOException e) {
				LOGGER.fatal(e);
			}
		}
	}
} public class EchoServerNettyTest {
	private static final Logger LOGGER = Logger.getLogger(EchoServerNettyTest.class);

	private static final int SERVER_PORT = 8080;

	public static boolean SSL_ENABLE = false;

	public static void main(String... args) throws Exception {
		new EchoServerNettyTest().start();
	}

	public void start() {
		// Configure the server.
		ServerBootstrap bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(
				Executors.newCachedThreadPool(), Executors.newCachedThreadPool()));

		// Set up the event pipeline factory.
		bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
			public ChannelPipeline getPipeline() throws Exception {
				ChannelPipeline pipeline = pipeline();

				pipeline.addLast("decoder", new HttpRequestDecoder());
				pipeline.addLast("aggregator", new HttpChunkAggregator(65536));
				pipeline.addLast("encoder", new HttpResponseEncoder());
				pipeline.addLast("handler", new SocketIOServer(EchoEventsHandler.class, SSL_ENABLE));
				return pipeline;
			}
		});

		// Bind and start to accept incoming connections.
		bootstrap.bind(new InetSocketAddress(SERVER_PORT));

		LOGGER.info("Server is started on port " + SERVER_PORT);
	}
} public class SocketIOServer extends SimpleChannelUpstreamHandler {
	private static final Logger LOGGER = Logger.getLogger(SocketIOServer.class);

	public static final String WEBSOCKET_PATH = "/socket.io/";
	public static final String JSESSIONID = "WSESSIONID";

	private static final String transportList = SocketIOTransportManager.getTransportsString();
	private static final int timeout = SocketIOTransportManager.getSocketIOTimeOut();
	private static final int expireTime = SocketIOTransportManager.getSocketIOExpireSession();
	public boolean https;

	private Class<? extends SocketIOInbound> clazz;

	public SocketIOServer(Class<? extends SocketIOInbound> clazz, final boolean https) {
		super();
		this.clazz = clazz;
		this.https = https;
	}

	@Override
	public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
		LOGGER.trace("messageReceived");

		Object msg = e.getMessage();
		if (msg instanceof HttpRequest) {
			handleHttpRequest(ctx, (HttpRequest) msg);
			return;
		} else {
			throw new UnsupportedOperationException();
		}
	}

	private void handleHttpRequest(ChannelHandlerContext ctx, HttpRequest req) throws Exception {
		LOGGER.trace("handleHttpRequest");

		HttpMethod method = req.getMethod();
		if (!HttpMethod.GET.equals(method) && !HttpMethod.POST.equals(method)) {
			final HttpResponseStatus status = new HttpResponseStatus(BAD_REQUEST.getCode(), "Socket.IO invalid method'"
					+ method + "'");
			sendHttpResponse(ctx, req, new DefaultHttpResponse(HTTP_1_1, status));
		}

		QueryStringDecoder decoder = new QueryStringDecoder(req.getUri());
		LOGGER.debug("Request URI[" + req.getUri() + "]");
		String path = decoder.getPath();

		/* Socket.IO Specifies that path starts with '/socket.io/' */
		if (!path.startsWith(WEBSOCKET_PATH)) {
			final HttpResponseStatus status = new HttpResponseStatus(BAD_REQUEST.getCode(),
					"Socket.IO path is invalid '" + path + "'");
			sendHttpResponse(ctx, req, new DefaultHttpResponse(HTTP_1_1, status));
			return;
		}

		/*
		 * remove first part of path and its slashes, otherwise initial tokens
		 * will be ignored
		 */
		path = path.replace(WEBSOCKET_PATH, "");

		/* Ignore empty requests */
		if (path == null || path.length() == 0 || "/".equals(path)) {
			final HttpResponseStatus status = new HttpResponseStatus(BAD_REQUEST.getCode(),
					"Missing SocketIO transport");
			sendHttpResponse(ctx, req, new DefaultHttpResponse(HTTP_1_1, status));
			return;
		}

		/* split parameters */
		final String[] parts = path.split("/");

		/*
		 * If only one parameter is provided, this is a new non-handshake
		 * connection. The parameter gives the Socket.IO version.
		 */
		if (parts.length == 1) {
			final int version = Integer.parseInt(parts[0]);

			/* Handle only supported socket.IO versions */
			switch (version) {
				case 1:
					// done above...
					break;
				default:
					HttpResponseStatus status = new HttpResponseStatus(NOT_IMPLEMENTED.getCode(), "Verion " + version
							+ " is not supported yet");
					sendHttpResponse(ctx, req, new DefaultHttpResponse(HTTP_1_1, status));
					return;
			}

			final HttpResponse response = new DefaultHttpResponse(HTTP_1_1, OK);

			final String sessionID = Utils.getUniqueSocketIOSessionID();

			// Response body
			String hs = sessionID + ":" + timeout + ":" + expireTime + ":" + transportList;

			List<String> tmpParam = decoder.getParameters().get("jsonp");

			if (tmpParam != null) {
				if (!tmpParam.isEmpty()) {
					String jsonpIdx = tmpParam.get(0);
					hs = "io.j[" + jsonpIdx + "](\"" + hs + "\");";
				}
			}

			response.addHeader("Access-Control-Allow-Origin", "*");
			response.addHeader(HttpHeaders.Names.CONTENT_TYPE, "application/javascript; charset=UTF-8");

			// Add session cookie.
			// TODO: make cookie persistent? create a Cookie and set its
			// properties
			CookieEncoder cookieEnc = new CookieEncoder(true);
			cookieEnc.addCookie(JSESSIONID, sessionID);
			response.setHeader(HttpHeaders.Names.SET_COOKIE, cookieEnc.encode());

			final ChannelBuffer content = ChannelBuffers.copiedBuffer(hs, CharsetUtil.US_ASCII);
			setContentLength(response, content.readableBytes());
			response.setContent(content);
			sendHttpResponse(ctx, req, response);
			return;
		}

		/*
		 * If a socket.IO versions and protocol are specified do the handshake
		 */
		if (parts.length >= 2) {
			final String transportName = parts[1];
			final String sessionsID = parts[2];

			/* Get transport handler */
			SocketIOTransport transport = SocketIOTransportManager.get(transportName);
			if (transport == null) {
				final HttpResponseStatus status = new HttpResponseStatus(FORBIDDEN.getCode(),
						"Unknow Socket.IO Transport '" + transportName + "'");
				final HttpResponse res = new DefaultHttpResponse(HTTP_1_1, status);
				sendHttpResponse(ctx, req, res);
				return;
			}

			/* Validate session bebore handshake */
			final SocketIOInbound inbound = clazz.newInstance();
			if (!inbound.validate(req.getUri())) {
				final HttpResponseStatus status = new HttpResponseStatus(FORBIDDEN.getCode(),
						"SocketIO Validation failed '" + transportName + "'");
				final HttpResponse res = new DefaultHttpResponse(HTTP_1_1, status);
				sendHttpResponse(ctx, req, res);
				return;
			}

			/* do handshake */
			final HttpResponse res = new DefaultHttpResponse(HTTP_1_1, OK);

			/* Create a Socket.IO session */
			SocketIOSession session = new SocketIOSession(sessionsID, inbound);

			transport.handleRequest(ctx, req, res, session, https);
			return;
		}

		// Send an error page otherwise.
		sendHttpResponse(ctx, req, new DefaultHttpResponse(HTTP_1_1, FORBIDDEN));
	}

	/**
	 * Send a response to the client
	 * 
	 * @param ctx
	 * @param req
	 * @param res
	 */
	private void sendHttpResponse(ChannelHandlerContext ctx, HttpRequest req, HttpResponse res) {
		LOGGER.trace("sendHttpResponse");

		// Generate an error page if response status code is not OK (200).
		if (res.getStatus().getCode() != 200) {
			res.setContent(ChannelBuffers.copiedBuffer(res.getStatus().toString(), CharsetUtil.UTF_8));
			setContentLength(res, res.getContent().readableBytes());
		}

		// Send the response and close the connection if necessary.
		ChannelFuture f = ctx.getChannel().write(res);
		if (!isKeepAlive(req) || res.getStatus().getCode() != 200)
			f.addListener(ChannelFutureListener.CLOSE);
	}

	@Override
	public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception {
		LOGGER.trace("exceptionCaught");
		e.getCause().printStackTrace();
		e.getChannel().close();
	}
} public interface SocketIOInbound {

	/**
	 * Called before the connection is established. This will provide the
	 * ability
	 * to validate some parameters from connection string.
	 * 
	 * @param URI
	 *            The SocketOutbound associated with the connection
	 * 
	 * @return
	 *         - true, proceed to handshake
	 *         - false, fail the handshake
	 */
	public boolean validate(final String URI);

	/**
	 * Called when the connection is established. This will only ever be called
	 * once.
	 * 
	 * @param outbound
	 *            The SocketOutbound associated with the connection
	 * @param endPoint
	 *            Topic where the message belongs
	 */
	public void onConnect(final SocketIOOutbound outbound, final String endPoint);

	/**
	 * Called when the socket connection is closed. This will only ever be
	 * called once. This method may be called instead of onConnect() if the
	 * connection handshake isn't completed successfully.
	 * 
	 * @param reason
	 *            The reason for the disconnect.
	 * @param errorMessage
	 *            Possibly non null error message associated with the reason for
	 *            disconnect.
	 */
	public void onDisconnect(final DisconnectReason reason, final String errorMessage);

	/**
	 * Called when the socket connection is closed. This will only ever be
	 * called once. This method may be called instead of onConnect() if the
	 * connection handshake isn't completed successfully.
	 * 
	 * @param reason
	 *            The reason for the disconnect.
	 * @param errorMessage
	 *            Possibly non null error message associated with the reason for
	 *            disconnect.
	 * @param endPoint
	 *            Topic where the message belongs
	 */
	public void onDisconnect(final DisconnectReason reason, final String errorMessage, final String endPoint);

	/**
	 * Called one per arriving a text message.
	 * 
	 * @param messageID
	 *            Unique message identifier
	 * @param endPoint
	 *            Topic where the message belongs
	 * @param message
	 *            Message data
	 */
	public void onMessage(final long messageID, final String endPoint, final String message);

	/**
	 * Called one per arriving a JSON message.
	 * 
	 * @param messageID
	 *            Unique message identifier
	 * @param endPoint
	 *            Topic where the message belongs
	 * @param message
	 *            Message data in JSON format
	 */
	public void onJSONMessage(final long messageID, final String endPoint, final String message);

	/**
	 * Called to handle Socket.IO events. Only deals events which are not
	 * registered in the event listener with
	 * {@link SocketIOSessionEventRegister}
	 * 
	 * @param messageID
	 *            Unique message identifier
	 * @param endPoint
	 *            Topic where the message belongs
	 * @param eventName
	 *            Name of received event
	 * @param data
	 *            Message data in JSON format
	 */
	public void onEvent(final long messageID, final String endPoint, final String eventName, final String data);

	/**
	 * Called to handle a acknowledgment which isn't handled by the socket.io
	 * 
	 * @param messageID
	 * @param data
	 */
	public void onAck(final long messageID, final String data);

	/**
	 * Called when a error occurs
	 * 
	 * @param endPoint
	 * @param reason
	 * @param advice
	 */
	public void onError(final String endPoint, final String reason, final String advice);
}
import static org.jboss.netty.channel.Channels.pipeline;
import java.net.InetSocketAddress;
import java.util.concurrent.Executors;
import org.apache.log4j.Logger;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
import org.jboss.netty.handler.codec.http.HttpChunkAggregator;
import org.jboss.netty.handler.codec.http.HttpRequestDecoder;
import org.jboss.netty.handler.codec.http.HttpResponseEncoder;
import eu.k2c.socket.io.ci.usecases.UC01Handler;
import eu.k2c.socket.io.ci.usecases.UC02Handler;
import eu.k2c.socket.io.ci.usecases.UC03Handler;
import eu.k2c.socket.io.ci.usecases.UC04Handler;
import eu.k2c.socket.io.ci.usecases.UC05Handler;
import eu.k2c.socket.io.ci.usecases.UC06Handler;
import eu.k2c.socket.io.ci.usecases.UC07Handler;
import eu.k2c.socket.io.ci.usecases.UC08Handler;
import eu.k2c.socket.io.ci.usecases.UC09Handler;
import eu.k2c.socket.io.ci.usecases.UC10Handler;
import eu.k2c.socket.io.ci.usecases.UC11Handler;
import eu.k2c.socket.io.ci.usecases.UC12Handler;
import eu.k2c.socket.io.ci.usecases.UC13Handler;
import eu.k2c.socket.io.ci.usecases.UC14Handler;
import eu.k2c.socket.io.ci.usecases.UC15Handler;
import eu.k2c.socket.io.ci.usecases.UC16Handler;
import eu.k2c.socket.io.ci.usecases.UC17Handler;
import eu.k2c.socket.io.ci.usecases.UC18Handler;
import eu.k2c.socket.io.ci.usecases.UC19Handler;
import eu.k2c.socket.io.example.echo.EchoServerNettyTest;
import eu.k2c.socket.io.server.SocketIOServer;
import eu.k2c.socket.io.server.api.SocketIOInbound;
/**
 * Copyright (C) 2011 K2C @ Patrick Marques <patrickfmarques@gmail.com>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
 * this software and associated documentation files (the "Software"), to deal in
 * the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
 * of the Software, and to permit persons to whom the Software is furnished to do
 * so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 *
 * Except as contained in this notice, the name(s) of the above copyright holders
 * shall not be used in advertising or otherwise to promote the sale, use or other
 * dealings in this Software without prior written authorization.
 */
package eu.k2c.socket.io.ci;





public class CISocketIOServerTest {
	private static final Logger LOGGER = Logger.getLogger(EchoServerNettyTest.class);

	private int port = 8080;

	private Class<? extends SocketIOInbound> classHdlr;

	public static boolean SSL_ENABLE = false;

	public static void main(String... args) throws Exception {
		int port = 8080;
		new CISocketIOServerTest(port, UC01Handler.class).start();
		new CISocketIOServerTest(++port, UC02Handler.class).start();
		new CISocketIOServerTest(++port, UC03Handler.class).start();
		new CISocketIOServerTest(++port, UC04Handler.class).start();
		new CISocketIOServerTest(++port, UC05Handler.class).start();
		new CISocketIOServerTest(++port, UC06Handler.class).start();
		new CISocketIOServerTest(++port, UC07Handler.class).start();
		new CISocketIOServerTest(++port, UC08Handler.class).start();
		new CISocketIOServerTest(++port, UC09Handler.class).start();
		new CISocketIOServerTest(++port, UC10Handler.class).start();
		new CISocketIOServerTest(++port, UC11Handler.class).start();
		new CISocketIOServerTest(++port, UC12Handler.class).start();
		new CISocketIOServerTest(++port, UC13Handler.class).start();
		new CISocketIOServerTest(++port, UC14Handler.class).start();
		new CISocketIOServerTest(++port, UC15Handler.class).start();
		new CISocketIOServerTest(++port, UC16Handler.class).start();
		new CISocketIOServerTest(++port, UC17Handler.class).start();
		new CISocketIOServerTest(++port, UC18Handler.class).start();
		new CISocketIOServerTest(++port, UC19Handler.class).start();