@Override
	public void run() {
		Socket s = null;
		BufferedReader br = null;
		br = new BufferedReader(new InputStreamReader(System.in));
		try {
			this.host = new ServerSocket(this.port);
			printHostInfo();
			s = this.host.accept();
			printConnectedInfo(s);
		} catch (IOException e1) {
			log.severe(e1.toString());
		}
		try {
			if (initCom(s, key)) {
				while (this.isRunning) {
					try {
						String msg = Message.receiveandDecrypt(s, this.pass);
						System.out.println("Decrypted: " + msg);
						Thread.sleep(2000);
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			} else {
				isRunning = false;
			}
		} catch (Exception e) {
			shutdown(br, s);
		}
		shutdown(br, s);
	}