@@ -0,0 +1,1360 @@
+/**%0A * %0A */%0Apackage com.trendrr.zmq.example;%0A%0Aimport java.io.UnsupportedEncodingException;%0Aimport java.util.concurrent.atomic.AtomicLong;%0A%0Aimport org.apache.commons.logging.Log;%0Aimport org.apache.commons.logging.LogFactory;%0A%0Aimport com.trendrr.zmq.server.ZMQChannel;%0Aimport com.trendrr.zmq.server.ZMQServer;%0Aimport com.trendrr.zmq.server.ZMQServerMessageHandler;%0A%0A%0A/**%0A * @author Dustin Norlander%0A * @created May 29, 2012%0A * %0A */%0Apublic class ZMQServerExampleMain %7B%0A%0A%09protected static Log log = LogFactory.getLog(ZMQServerExampleMain.class);%0A%0A%09/**%0A%09 * This is a simple echo server.  %0A%09 * %0A%09 * %0A%09 * @param args%0A%09 */%0A%09public static void main(String%5B%5D args) %7B%0A%09%09ZMQServer server = new ZMQServer();%0A%09%09ZMQServerMessageHandler handler = new ZMQServerMessageHandler() %7B%0A//%09%09%09AtomicLong received = new AtomicLong(0);%0A%09%09%09%0A%09%09%09@Override%0A%09%09%09public void incoming(ZMQChannel channel, byte%5B%5D message) %7B%0A%09%09%09%09try %7B%0A%09%09%09%09%09String received = new String(message, %22utf8%22);%0A%09%09%09%09%09String id = new String(channel.getId(), %22utf8%22);%0A//%09%09%09%09%09System.out.println(%22SERVER RECIEVED: %22 + received + %22 from ID: %22 + id);%0A%09%09%09%09%7D catch (UnsupportedEncodingException e) %7B%0A%09%09%09%09%09e.printStackTrace();%0A%09%09%09%09%7D%0A%09%09%09%09//send back the message..%0A%09%09%09%09channel.send(message);%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09@Override%0A%09%09%09public void error(Exception x) %7B%0A%09%09%09%09x.printStackTrace();%0A%09%09%09%7D%0A%09%09%7D;%0A%09%09%0A%09%09server.listen(8988, handler, false);%0A%0A%09%7D%0A%7D%0A

add an example main