@Test public void testPacketReceived() throws PasswordException { packetFolder.store(emailPacket); assertEquals(1, packetFolder.getElements().size()); EmailPacketDeleteRequest delRequest; byte[] delAuthBytes = unencryptedPacket.getDeleteAuthorization().toByteArray().clone(); delAuthBytes[5] ^= 1; UniqueId invalidAuthorization = new UniqueId(delAuthBytes, 0); delRequest = new EmailPacketDeleteRequest(emailPacket.getDhtKey(), invalidAuthorization); packetFolder.packetReceived(delRequest, sender, System.currentTimeMillis()); assertEquals(1, packetFolder.getElements().size()); delRequest = new EmailPacketDeleteRequest(emailPacket.getDhtKey(), unencryptedPacket.getDeleteAuthorization()); packetFolder.packetReceived(delRequest, sender, System.currentTimeMillis()); assertEquals(0, packetFolder.getElements().size()); }
@Override public void packetReceived(CommunicationPacket packet, Destination sender, long receiveTime) { if (packet instanceof EmailPacketDeleteRequest) { EmailPacketDeleteRequest delRequest = (EmailPacketDeleteRequest)packet; process(delRequest); } }
EmailPacketFolder extends DeletionAwareDhtFolder<EncryptedEmailPacket> implements PacketListener, ExpirationListener { @Override public void packetReceived(CommunicationPacket packet, Destination sender, long receiveTime) { if (packet instanceof EmailPacketDeleteRequest) { EmailPacketDeleteRequest delRequest = (EmailPacketDeleteRequest)packet; process(delRequest); } } }
EmailPacketFolder extends DeletionAwareDhtFolder<EncryptedEmailPacket> implements PacketListener, ExpirationListener { @Override public void packetReceived(CommunicationPacket packet, Destination sender, long receiveTime) { if (packet instanceof EmailPacketDeleteRequest) { EmailPacketDeleteRequest delRequest = (EmailPacketDeleteRequest)packet; process(delRequest); } } EmailPacketFolder(File storageDir); }
EmailPacketFolder extends DeletionAwareDhtFolder<EncryptedEmailPacket> implements PacketListener, ExpirationListener { @Override public void packetReceived(CommunicationPacket packet, Destination sender, long receiveTime) { if (packet instanceof EmailPacketDeleteRequest) { EmailPacketDeleteRequest delRequest = (EmailPacketDeleteRequest)packet; process(delRequest); } } EmailPacketFolder(File storageDir); @Override void store(DhtStorablePacket packetToStore); @Override DhtStorablePacket retrieve(Hash dhtKey); @Override void packetReceived(CommunicationPacket packet, Destination sender, long receiveTime); @Override synchronized void process(DeleteRequest delRequest); @Override synchronized void deleteExpired(); @Override UniqueId getDeleteAuthorization(Hash dhtKey); @Override DeleteRequest storeAndCreateDeleteRequest(DhtStorablePacket packetToStore); }
EmailPacketFolder extends DeletionAwareDhtFolder<EncryptedEmailPacket> implements PacketListener, ExpirationListener { @Override public void packetReceived(CommunicationPacket packet, Destination sender, long receiveTime) { if (packet instanceof EmailPacketDeleteRequest) { EmailPacketDeleteRequest delRequest = (EmailPacketDeleteRequest)packet; process(delRequest); } } EmailPacketFolder(File storageDir); @Override void store(DhtStorablePacket packetToStore); @Override DhtStorablePacket retrieve(Hash dhtKey); @Override void packetReceived(CommunicationPacket packet, Destination sender, long receiveTime); @Override synchronized void process(DeleteRequest delRequest); @Override synchronized void deleteExpired(); @Override UniqueId getDeleteAuthorization(Hash dhtKey); @Override DeleteRequest storeAndCreateDeleteRequest(DhtStorablePacket packetToStore);  }