@Test
   public static void testInfoQuery() throws Exception
   {
      String jobName = "TestInfoJob-" + System.currentTimeMillis() + Math.random();
      final String PSV = "ECONOMODE";
      final String on = "ON";
      final String off = "OFF";
      final String target;

      ArrayList<Command> commands = new ArrayList<Command>();
      commands.add(new Comment(" Testing 1 2 3 "));

      UnsolicitedStatus printerStatus = new UnsolicitedStatus(
            new UnsolicitedDeviceType(UnsolicitedDeviceType.InputValue.ON));

      printerStatus.addInputListener(new InputEventListener() {
         public void inputEventOccurred(InputEvent event) {
            if (event.getSource() instanceof UnsolicitedDeviceType) {
               UnsolicitedDeviceType usd = (UnsolicitedDeviceType)event.getSource();
               System.err.printf("Code: %s Online: %s Display: %s%n",
                     usd.getCode(), usd.getOnline(), usd.getDisplay());
            }
         }
      });
      commands.add(printerStatus);

      Job j = new Job(jobName, "Troy's Test Job");
      j.getPageUStatus().addInputListener(new InputEventListener()
      {
         public void inputEventOccurred(InputEvent event)
         {
            if (event.getSource() instanceof UnsolicitedPageType)
            {
               System.err.println("Printed page " + ((UnsolicitedPageType)event.getSource()).getPage());
            }
         }
      });
      j.getJobUStatus().addInputListener(new InputEventListener() {
         public void inputEventOccurred(InputEvent event) {
            if (event.getSource() instanceof UnsolicitedJobType) {
               System.err.println(event.getSource().toString());
            }
         }
      });
      commands.add(j);
      Info info = new Info(VariableCategory.VARIABLES);
      info.addInputListener(new InputEventListener()
      {
         public void inputEventOccurred(InputEvent event)
         {
            if (event.getSource() instanceof Variable)
            {
               System.err.println("Variable changed/added: " + event.getSource());
            }
            if (event.getSource() instanceof Info)
            {
               System.err.println("Info object changed: " + event.getSource());
            }
         }
      });
      commands.add(info);
      Info infoConfig = new Info(VariableCategory.CONFIG);
      infoConfig.addInputListener(new InputEventListener() {
         public void inputEventOccurred(InputEvent event) {
            if (event.getSource() instanceof Variable) {
               System.err.println("config variable " + event.getSource());
            }
         }
      });
      commands.add(infoConfig);
      commands.add(new EndOfJob(jobName));

      SocketClient sc = SocketClient.getSocket(printer);
      String output = sc.invokePjlCommands(commands);
      if (output.length() > 0)
      {
         System.err.println("OUTPUT: " + output);
      }

      // set the target to the opposite of what it already is.
      target = info.getVariable(PSV).getValue().equals(on) ? off : on;

      assert infoConfig.getVariable("MEMORY").getValue().matches("^\\d+$")
            : "Didn't get a number for the config variable MEMORY";

      Variable newVariable = info.getVariable(PSV).copy();
      newVariable.setValue(target);
      jobName = "TestInfoJob-" + System.currentTimeMillis() + Math.random();
      Vector<Command> commands2 = new Vector<Command>();
      Job j2 = new Job(jobName);
      commands2.add(j2);
      commands2.add(new Set(newVariable));
      Inquire inquire = new Inquire(info.getVariable(PSV));
      commands2.add(inquire);
      commands2.add(new EndOfJob(jobName));

      inquire.addInputListener(new InputEventListener()
      {
         public void inputEventOccurred(InputEvent event)
         {
            System.err.println("Changed: " + ((Inquire)event.getSource()).getVariable().toString());
         }
      });

      sc = SocketClient.getSocket(printer);
      output = sc.invokePjlCommands(commands2);
      if (output.length() > 0)
      {
         System.err.println("OUTPUT: " + output);
      }

      // verify ptsize is a number
      assert inquire.getVariable().getValue().matches("^(OFF|ON)$")
            : PSV + " of " + info.getVariable(PSV).getValue() + " isn't expected";
      // verify that the one set through the event == the target value
      assert inquire.getVariable().getValue().equals(target)
            : "event variable doesn't match the target variable";
   }