}
@Test
public void testRemovalMultipleContentKey() throws ClassNotFoundException, IOException,
NoPeerConnectionException {
NetworkManager nodeA = network.get(random.nextInt(networkSize / 2));
NetworkManager nodeB = network.get(random.nextInt(networkSize / 2) + networkSize / 2);
String locationKey = nodeB.getNodeId();
String contentKey1 = NetworkTestUtil.randomString();
String testString1 = NetworkTestUtil.randomString();
Parameters parameters1 = new Parameters().setLocationKey(locationKey).setContentKey(contentKey1)
.setData(new H2HTestData(testString1));
String contentKey2 = NetworkTestUtil.randomString();
String testString2 = NetworkTestUtil.randomString();
Parameters parameters2 = new Parameters().setLocationKey(locationKey).setContentKey(contentKey2)
.setData(new H2HTestData(testString2));
String contentKey3 = NetworkTestUtil.randomString();
String testString3 = NetworkTestUtil.randomString();
Parameters parameters3 = new Parameters().setLocationKey(locationKey).setContentKey(contentKey3)
.setData(new H2HTestData(testString3));
// insert them
FuturePut put1 = nodeA.getDataManager().putUnblocked(parameters1);
put1.awaitUninterruptibly();
FuturePut put2 = nodeA.getDataManager().putUnblocked(parameters2);
put2.awaitUninterruptibly();
FuturePut put3 = nodeA.getDataManager().putUnblocked(parameters3);
put3.awaitUninterruptibly();
// check that they are all stored
FutureGet futureGet = nodeB.getDataManager().getUnblocked(parameters1);
futureGet.awaitUninterruptibly();
assertEquals(testString1, ((H2HTestData) futureGet.getData().object()).getTestString());
futureGet = nodeB.getDataManager().getUnblocked(parameters2);
futureGet.awaitUninterruptibly();
assertEquals(testString2, ((H2HTestData) futureGet.getData().object()).getTestString());
futureGet = nodeB.getDataManager().getUnblocked(parameters3);
futureGet.awaitUninterruptibly();
assertEquals(testString3, ((H2HTestData) futureGet.getData().object()).getTestString());
// remove 2nd one and check that 1st and 3rd are still there
nodeA.getDataManager().removeUnblocked(parameters2).awaitUninterruptibly();
futureGet = nodeB.getDataManager().getUnblocked(parameters1);
futureGet.awaitUninterruptibly();
assertEquals(testString1, ((H2HTestData) futureGet.getData().object()).getTestString());
futureGet = nodeB.getDataManager().getUnblocked(parameters2);
futureGet.awaitUninterruptibly();
assertNull(futureGet.getData());
futureGet = nodeB.getDataManager().getUnblocked(parameters3);
futureGet.awaitUninterruptibly();
assertEquals(testString3, ((H2HTestData) futureGet.getData().object()).getTestString());
// remove 3rd one as well and check that they are gone as well
nodeA.getDataManager().removeUnblocked(parameters1).awaitUninterruptibly();
nodeA.getDataManager().removeUnblocked(parameters3).awaitUninterruptibly();
futureGet = nodeB.getDataManager().getUnblocked(parameters1);
futureGet.awaitUninterruptibly();
assertNull(futureGet.getData());
futureGet = nodeB.getDataManager().getUnblocked(parameters2);
futureGet.awaitUninterruptibly();
assertNull(futureGet.getData());
futureGet = nodeB.getDataManager().getUnblocked(parameters3);
futureGet.awaitUninterruptibly();
assertNull(futureGet.getData());
}