public void sendCommand(Command command) {

		try {

			// build JSONObject
			JSONObject jsonCommand = new JSONObject().put(command.getCommand(), command.getParam());

			// send command upstream
			upstreamOutput.write(jsonCommand.toString());
			upstreamOutput.newLine();
			upstreamOutput.flush();

			// get command ack
			JSONObject jsonCommandAck = new JSONObject(upstreamInput.readLine());

			if (jsonCommandAck.has("errorOccurred")) {

				// build error
				CommandExecutionError error = new CommandExecutionError(jsonCommandAck.getJSONObject("errorOccurred")
						.getString("whileExecutingCommand"), jsonCommandAck.getJSONObject("errorOccurred").getString(
						"withReason"));

				// process error
				processor.processError(error);

			}
		} catch (JSONException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}