protected void verifyEncryptedResult(SecretKey sessionKey, String result) throws Exception {
    try {
      result = decryptResult(sessionKey, result);
    } catch (DecryptionException e) {
      LOGGER.error("decryption failed.");
      LOGGER.error(result);
    }

    if (!result.contains("The answer to life the universe and everything")) {
      SecureResponse readValue = new ObjectMapper().readValue(result, SecureResponse.class);
      MethodResult result2 = readValue.getMessage().getResult();
      if (result2.getType().equals(MethodResult.ReturnType.Exception)) {
        LOGGER.error(result2.getArg().toString());
      }
      assertThat(result, containsString("The answer to life the universe and everything"));
    }
  }
 private static MethodResult convertResult(SecureResponse resultMessage)
     throws ClassNotFoundException {
   MethodResult result = resultMessage.getMessage().getResult();
   Class<?> clazz = Class.forName(result.getClassName());
   Object resultValue = MAPPER.convertValue(result.getArg(), clazz);
   result.setArg(resultValue);
   return result;
 }