@SuppressWarnings("unchecked")
	public void run() {
		try {
			while (!isInterrupted()) {
					Serializable data = getNextMessageFromQueue();
					if (data instanceof KeepAliveMessage) {
						
					} 
					else if(data instanceof ClientToClientMessage) {
						getIncomeClientMsglistener().massageReceived((ClientToClientMessage)data);
					}
					else if(data instanceof CommandMessage) {
						System.out.println("ClientReaderThread: readCommand class:"+data.getClass());
					
						synchronized (getCommandListeners()) {
							
							@SuppressWarnings("rawtypes")
							CommandListener listener = getCommandListeners().get(data.getClass());
							if(listener == null) {
								continue;
							}
							if(listener.useOnceOnly()) {
								 getCommandListeners().remove(listener.getClass());
							}
							listener.commandReceived(data);
						}
					}
			}
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}