public void testChangeProtectionKeySingleVersionKey() throws NoPeerConnectionException, IOException,
InvalidKeyException, SignatureException {
KeyPair keypairOld = EncryptionUtil.generateRSAKeyPair();
KeyPair keypairNew = EncryptionUtil.generateRSAKeyPair();
H2HTestData data = new H2HTestData(NetworkTestUtil.randomString());
data.generateVersionKey();
data.setBasedOnKey(Number160.ZERO);
Parameters parameters = new Parameters().setLocationKey(NetworkTestUtil.randomString())
.setContentKey(NetworkTestUtil.randomString()).setVersionKey(data.getVersionKey())
.setData(data).setProtectionKeys(keypairOld).setNewProtectionKeys(keypairNew)
.setTTL(data.getTimeToLive()).setHashFlag(true);
NetworkManager node = network.get(random.nextInt(networkSize));
// put some initial data
FuturePut putFuture1 = node.getDataManager().putUnblocked(parameters);
putFuture1.awaitUninterruptibly();
Assert.assertTrue(putFuture1.isSuccess());
// parameters without the data object itself
parameters = new Parameters().setLocationKey(parameters.getLocationKey())
.setContentKey(parameters.getContentKey()).setVersionKey(data.getVersionKey())
.setProtectionKeys(keypairOld).setNewProtectionKeys(keypairNew)
.setTTL(data.getTimeToLive());
// change content protection key
FuturePut changeFuture = node.getDataManager().changeProtectionKeyUnblocked(parameters);
changeFuture.awaitUninterruptibly();
Assert.assertTrue(changeFuture.isSuccess());