/* 
 * Copyright (c) 2012, noxan
 * See LICENSE for details.
 */

package com.github.noxan.aves.demo;

import java.io.IOException;

import com.github.noxan.aves.net.Connection;
import com.github.noxan.aves.server.Server;
import com.github.noxan.aves.server.ServerHandler;
import com.github.noxan.aves.server.SocketServer;

public class DemoServer implements ServerHandler {
    public static void main(String[] args) {
        Server server = new SocketServer(new DemoServer());
        try {
            server.start();
        } catch(IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void readData(Connection connection, Object data) {
        System.out.println(connection + ": " + data);
    }

    @Override
    public void clientConnect(Connection connection) {
        System.out.println(connection + " connect");
    }

    @Override
    public void clientDisconnect(Connection connection) {
        System.out.println(connection + " disconnect");
    }

    @Override
    public void clientLost(Connection connection) {
        System.out.println(connection + " lost");
    }
}

@@ -719,9 +719,10 @@
  + %22
-:
+ %3E
  %22 +
@@ -1121,11 +1121,151 @@
 );%0A    %7D
+%0A%0A    @Override%0A    public void writeData(Connection connection, Object data) %7B%0A        System.out.println(connection + %22 %3C %22 + data);%0A    %7D
 %0A%7D%0A

add write data event to demo server and update readdata separator