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

package com.github.noxan.aves.demo;

import com.github.noxan.aves.net.Connection;
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) {
	new DemoServer();
    }

    private SocketServer server;

    public DemoServer() {
	server = new SocketServer(this);
	server.start();
    }

    @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");
    }
}

@@ -96,16 +96,45 @@
 .demo;%0A%0A
+import java.io.IOException;%0A%0A
 import c
@@ -170,16 +170,60 @@
 ection;%0A
+import com.github.noxan.aves.server.Server;%0A
 import c
@@ -416,45 +416,35 @@
 ) %7B%0A
-%09new DemoServer();%0A    %7D%0A%0A    private
+        Server server = new
  Soc
@@ -456,94 +456,146 @@
 rver
- s
+(new DemoS
 erver
+())
 ;
-%0A
 %0A    
-public DemoServer() %7B%0A%09server = new SocketServer(this);%0A%09server.start();
+    try %7B%0A            server.start();%0A        %7D catch (IOException e) %7B%0A            e.printStackTrace();%0A        %7D
 %0A   

rework demo server starting process