public void testInferenceProblemStoreReuse() {
    System.out.println("\n**** testInferenceProblemStoreReuse ****");

    CycAccess cycAccess = null;
    try {
      try {
        if (connectionMode == LOCAL_CYC_CONNECTION) {
          cycAccess = new CycAccess(testHostName, testBasePort);
        } else if (connectionMode == SOAP_CYC_CONNECTION) {
          cycAccess = new CycAccess(endpointURL, testHostName, testBasePort);
        } else {
          fail("Invalid connection mode " + connectionMode);
        }
      } catch (Throwable e) {
        fail(StringUtils.getStringForException(e));
      }

      try {
        if (!cycAccess.isOpenCyc()) {
          final String inferenceProblemStoreName = "my-problem-store";
          cycAccess.initializeNamedInferenceProblemStore(inferenceProblemStoreName, null);
          CycFormulaSentence query = cycAccess.makeCycSentence("(#$objectFoundInLocation ?WHAT ?WHERE)");
          CycList variables = new CycList();
          variables.add(makeCycVariable("?WHAT"));
          variables.add(makeCycVariable("?WHERE"));
          InferenceParameters queryProperties = new DefaultInferenceParameters(cycAccess);
          CycConstant universeDataMt = cycAccess.getKnownConstantByGuid(UNIVERSE_DATA_MT_GUID_STRING);
          CycList response = cycAccess.queryVariables(variables, query, universeDataMt, queryProperties, inferenceProblemStoreName);
          assertNotNull(response);
          response = cycAccess.queryVariables(variables, query, universeDataMt, queryProperties, inferenceProblemStoreName);
          assertNotNull(response);
          response = cycAccess.queryVariables(variables, query, universeDataMt, queryProperties, inferenceProblemStoreName);
          assertNotNull(response);
          cycAccess.destroyInferenceProblemStoreByName(inferenceProblemStoreName);
        }
      } catch (Throwable e) {
        e.printStackTrace();
        fail(e.toString());
      }
    } finally {
      if (cycAccess != null) {
        cycAccess.close();
        cycAccess = null;
      }
    }
    System.out.println("**** testInferenceProblemStoreReuse OK ****");
  }