public void testListAvailableIds() throws Exception {
    String authorAccountId = authorSecurity.getPublicKeyString();

    BulletinHeaderPacket bhp1 = new BulletinHeaderPacket(authorSecurity);
    bhp1.setStatus(BulletinConstants.STATUSSEALED);
    Vector result1 = writeSampleAvailableIDPacket(bhp1);

    BulletinHeaderPacket bhp2 = new BulletinHeaderPacket(authorSecurity);
    bhp2.setStatus(BulletinConstants.STATUSSEALED);
    Vector result2 = writeSampleAvailableIDPacket(bhp2);

    BulletinHeaderPacket bhpDraft = new BulletinHeaderPacket(authorSecurity);
    bhpDraft.setStatus(BulletinConstants.STATUSDRAFT);
    Vector resultDraft = writeSampleAvailableIDPacket(bhpDraft);

    supplier.authorizedCaller = callerAccountId;

    CallerSideMirroringInterface wrappedHandler = new PassThroughMirroringGateway(handler);

    Vector parameters = new Vector();
    parameters.add(MirroringInterface.CMD_MIRRORING_LIST_AVAILABLE_IDS);
    parameters.add(authorAccountId);
    String sig = callerSecurity.createSignatureOfVectorOfStrings(parameters);
    Vector result = wrappedHandler.request(callerAccountId, parameters, sig);
    assertEquals(NetworkInterfaceConstants.OK, result.get(0));
    Object[] infos = (Object[]) result.get(1);
    assertEquals(3, infos.length);
    boolean got1 = false;
    boolean got2 = false;
    boolean gotDraft = false;
    for (int i = 0; i < infos.length; ++i) {
      Object[] info = (Object[]) infos[i];
      String id = (String) info[0];
      String expectedId1 = (String) result1.get(0);
      if (id.equals(expectedId1)) got1 = true;
      String expectedId2 = (String) result2.get(0);
      if (id.equals(expectedId2)) got2 = true;
      String expectedIdDraft = (String) resultDraft.get(0);
      if (id.equals(expectedIdDraft)) gotDraft = true;
    }
    assertTrue("Didn't get bhp1?", got1);
    assertTrue("Didn't get bhp2?", got2);
    assertTrue("Didn't get bhpDraft?", gotDraft);
    Vector infosAsVector = new Vector(Arrays.asList(infos));

    CallerSideMirroringGateway gateway = new CallerSideMirroringGateway(wrappedHandler);
    LoggerToNull logger = new LoggerToNull();
    MockMartusServer server = new MockMartusServer();

    MirroringRetriever mirroringRetriever =
        new MirroringRetriever(server.getStore(), gateway, "Dummy IP", logger);
    Vector returnedListWeWantToMirror =
        mirroringRetriever.listOnlyPacketsThatWeWantUsingBulletinMirroringInformation(
            authorSecurity.getPublicKeyString(), infosAsVector);
    int bulletinsVerified = 0;
    for (int i = 0; i < returnedListWeWantToMirror.size(); i++) {
      BulletinMirroringInformation returnedInfo =
          (BulletinMirroringInformation) returnedListWeWantToMirror.get(i);
      bulletinsVerified = verifyStatus(bulletinsVerified, returnedInfo, bhp1, "BHP1");
      bulletinsVerified = verifyStatus(bulletinsVerified, returnedInfo, bhp2, "BHP2");
      bulletinsVerified = verifyStatus(bulletinsVerified, returnedInfo, bhpDraft, "BHPDRAFT");
    }
    assertEquals(3, bulletinsVerified);
    server.deleteAllFiles();
  }