示例#1
0
  /**
   * Create an IdentityCertificate from the content in the data packet.
   *
   * @param data The data packet with the content to decode.
   */
  public IdentityCertificate(Data data) throws DerDecodingException {
    super(data);

    if (!isCorrectName(data.getName()))
      throw new SecurityException("Wrong Identity Certificate Name!");

    setPublicKeyName();
  }
示例#2
0
  @Test
  public void testExpressingAnInterestAfterConfiguration()
      throws IOException, EncodingException, InterruptedException {
    // add response (before face is connected)
    Data response = new Data(new Name("/test/with/responses"));
    response.setContent(new Blob("..."));
    face.receive(response);

    // make request
    expressInterest("/test/with/responses");

    run(20);

    assertNotNull(recvData);
    assertEquals(isTimeout, false);
    assertEquals(recvData.getName().toString(), "/test/with/responses");
    assertEquals(recvData.getContent().buf(), new Blob("...").buf());
  }