Пример #1
0
  /**
   * Processes a KMIP-Request-Message stored in a <code>KMIPContainer</code> and returns a
   * corresponding KMIP-Response-Message. For test cases, there are two additional parameters that
   * may be set by the caller. The idea is, that the generated TTLV-Strings can be compared to the
   * expected TTLV-Strings.
   *
   * @param c : the <code>KMIPContainer</code> to be encoded and sent.
   * @param expectedTTLVRequest : the <code>String</code> to be compared to the encoded request
   *     message.
   * @param expectedTTLVResponse : the <code>String</code> to be compared to the decoded response
   *     message.
   * @return <code>KMIPContainer</code> with the response objects.
   */
  public KMIPContainer processRequest(
      KMIPContainer c, String expectedTTLVRequest, String expectedTTLVResponse) {
    // encode Request
    ArrayList<Byte> ttlv = encoder.encodeRequest(c);
    logger.info("Encoded Request from Client: (actual/expected)");
    KMIPUtils.printArrayListAsHexString(ttlv);
    logger.debug(expectedTTLVRequest);
    UCStringCompare.checkRequest(ttlv, expectedTTLVRequest);

    // send Request and check Response
    ArrayList<Byte> responseFromServer = transportLayer.send(ttlv);
    logger.info("Encoded Response from Server: (actual/expected)");
    KMIPUtils.printArrayListAsHexString(responseFromServer);
    logger.debug(expectedTTLVResponse);
    UCStringCompare.checkResponse(responseFromServer, expectedTTLVResponse);
    return decodeResponse(responseFromServer);
  }
Пример #2
0
 /**
  * Processes a KMIP-Request-Message stored in a <code>KMIPContainer</code> and returns a
  * corresponding KMIP-Response-Message.
  *
  * @param c : the <code>KMIPContainer</code> to be encoded and sent.
  * @return <code>KMIPContainer</code> with the response objects.
  */
 public KMIPContainer processRequest(KMIPContainer c) {
   ArrayList<Byte> ttlv = encoder.encodeRequest(c);
   ArrayList<Byte> responseFromServer = transportLayer.send(ttlv);
   return decodeResponse(responseFromServer);
 }