package net.dlogic.kryonet.client;

import java.io.IOException;

import net.dlogic.kryonet.common.request.LoginRequest;
import net.dlogic.kryonet.common.utility.KryonetUtility;

import com.esotericsoftware.kryonet.Client;

public class KryonetClient {
	private static Client client;
	public KryonetClient(int writeBufferSize, int objectBufferSize, int timeout, String host, int tcpPort, int udpPort) throws IOException {
		client = new Client(writeBufferSize, objectBufferSize);
		KryonetUtility.registerClasses(client);
		client.start();
		client.connect(timeout, host, tcpPort, udpPort);
		client.addListener(new KryonetClientListener());
	}
	public void sendLoginRequest(String username, String password) {
		LoginRequest request = new LoginRequest();
		request.username = username;
		request.password = password;
		client.sendTCP(request);
	}
}

@@ -89,437 +89,881 @@
 et.c
-ommon.request.LoginRequest;%0Aimport net.dlogic.kryonet.common.utility.KryonetUtility;%0A%0Aimport com.esotericsoftware.kryonet.Client;%0A%0Apublic class KryonetClient %7B%0A%09private static Client client;%0A%09public KryonetClient(int writeBufferSize, int objectBufferSize, int timeout, String host, int tcpPort, int udpPort) throws IOException %7B%0A%09%09client = new Client(writeBufferSize, objectBufferSize);%0A%09%09KryonetUtility.registerClasses(client);%0A
+lient.event.callback.ILoginOrLogoutEventCallback;%0Aimport net.dlogic.kryonet.client.event.callback.IPersonMessageEventCallback;%0Aimport net.dlogic.kryonet.client.event.callback.IRoomEventCallback;%0Aimport net.dlogic.kryonet.common.request.LoginRequest;%0Aimport net.dlogic.kryonet.common.utility.KryonetUtility;%0A%0Aimport com.esotericsoftware.kryonet.Client;%0Aimport com.esotericsoftware.kryonet.Listener;%0A%0Apublic class KryonetClient %7B%0A%09private Client client;%0A%09private KryonetClientListener listener;%0A%09public KryonetClient(int writeBufferSize, int objectBufferSize) %7B%0A%09%09client = new Client(writeBufferSize, objectBufferSize);%0A%09%09KryonetUtility.registerClasses(client);%0A%09%09client.addListener(listener = new KryonetClientListener());%0A%09%7D%0A%09public void start(int timeout, String host, int tcpPort, int udpPort) throws IOException, KryonetClientException %7B%0A%09%09if (!client.isConnected()) %7B%0A%09
 %09%09cl
@@ -976,16 +976,17 @@
 tart();%0A
+%09
 %09%09client
@@ -1030,34 +1030,126 @@
 ort);%0A%09%09
-client.add
+%7D else %7B%0A%09%09%09throw new KryonetClientException(%22client already connected%22);%0A%09%09%7D%0A%09%7D%0A%09public KryonetClient
 Listener
 (new Kry
@@ -1144,13 +1144,12 @@
 ener
-(new 
+ get
 Kryo
@@ -1159,32 +1159,211 @@
 ClientListener()
+ %7B%0A%09%09return listener;%0A%09%7D%0A%09public void addListener(Listener listener) %7B%0A%09%09client.addListener(listener);%0A%09%7D%0A%09public void registerClass(Class type) %7B%0A%09%09client.getKryo().register(type
 );%0A%09%7D%0A%09public vo

added methods addListener(), registerClass(), getKryonetClientListener(). refactored the class by separating the starting of the client to another method