package com.github.noxan.aves.client.socket;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;

import com.github.noxan.aves.client.Client;
import com.github.noxan.aves.client.ClientHandler;

public class SocketClient implements Client {
    private String host;
    private int port;
    private Socket socket;
    private ClientHandler handler;

    public SocketClient(ClientHandler handler) {
        this("localhost", 1666, handler);
    }

    public SocketClient(String host, int port, ClientHandler handler) {
        this.host = host;
        this.port = port;
        this.handler = handler;
    }

    @Override
    public String getHost() {
        return host;
    }

    @Override
    public int getPort() {
        return port;
    }

    @Override
    public void connect() throws IOException {
        socket = new Socket();
        socket.connect(new InetSocketAddress(host, port));
    }

    @Override
    public void disconnect() {
    }
}

@@ -842,16 +842,49 @@
 ption %7B%0A
+        handler.clientConnect();%0A
         
@@ -1013,20 +1013,56 @@
 connect() %7B%0A
+        handler.clientDisconnect();%0A
     %7D%0A%7D%0A

add handler calls for connect and disconnect to the according methods