public void run() {
			sockets.add(socket);
			onConnect(socket);
			try {
				BufferedReader in = new BufferedReader(new InputStreamReader(
						socket.getInputStream()));
				String line;
				while ((line = in.readLine()) != null) {
					if (!listening)
						return;
					onMessage(socket, line);
				}
			} catch (Exception ex) {
				if(!ex.getMessage().equals("socket closed"))
				ex.printStackTrace();
			}
			sockets.remove(getIndex(socket));
			onClose(socket);
		}