package com.github.noxan.aves.demo.chat;

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

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

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

    private Logger logger = Logger.getLogger(getClass().getName());

    public void start() throws IOException {
        server.start();
    }

    @Override
    public void readData(Connection connection, Object data) {
        logger.log(Level.INFO, data.toString());
    }

    @Override
    public void clientConnect(Connection connection) {
        logger.log(Level.INFO, connection + " connected");
    }

    @Override
    public void clientDisconnect(Connection connection) {
        logger.log(Level.INFO, connection + " disconnected");
    }

    @Override
    public void clientLost(Connection connection) {
        logger.log(Level.INFO, connection + " lost");
    }
}

@@ -129,16 +129,149 @@
 ogger;%0A%0A
+import com.github.noxan.aves.auth.session.SessionManager;%0Aimport com.github.noxan.aves.auth.storage.InMemoryUsernamePasswordStorage;%0A
 import c
@@ -745,16 +745,257 @@
 me());%0A%0A
+    private InMemoryUsernamePasswordStorage storage;%0A    private SessionManager sessionManager;%0A%0A    public ChatServer() %7B%0A        storage = new InMemoryUsernamePasswordStorage();%0A        sessionManager = new SessionManager(storage);%0A    %7D%0A%0A
     publ

add user storage and sessionamanger to chatserver