public void run() {
		//This method keeps listening the socket
		TaskMessage message;
		
		try {
			while(true){
				message = (TaskMessage) input.readObject();
				System.out.println("Message received");
				if(message != null){
					toRun.add(message);
				}
				Thread.sleep(Constants.LISTEN_INTERVAL);
			}
		} catch (EOFException e) {
			System.out.print("Connection Closed\n");
			//System.exit(0);
			try {
				closeSocket();
				initialize();
				run();
			} catch (IOException e1) {}
		} catch (InterruptedException e) {
		} catch (ClassNotFoundException e) {
		} catch (IOException e) {}
	}