public void run() {
		while (listen) {
			try {
				int encryptedSize = inStream.readInt();
				int rawSize = inStream.readInt();
				byte[] message = new byte[encryptedSize];
				int readSoFar = 0;
				while (readSoFar < encryptedSize)
					readSoFar += inStream.read(message, readSoFar,
							message.length - readSoFar);
				message = ClientManager.encryptionLayer.decrypt(message);
				if (rawSize != -1) {
					message = ClientManager.compressionLayer.decompress(
							message, rawSize);
				}
				if (message[0] == 0x10 || message[0] == 0x00)
					ClientManager.textQueue.addMessage(message);
				else
					ClientManager.sysQueue.addMessage(message);
			} catch (EOFException e) {
				System.out.println("User " + ClientManager.userName
						+ " is logging off");
				break;
			} catch (DataFormatException e) {
				System.out.println("Server message corrupted!");
			} catch (IOException e) {
				System.out.println(e);
				if (!listen)
					return;
				listen = false;
				JOptionPane.showMessageDialog(null, "Server is down!");
				ClientManager.logoff();
			}

		}
	}