PeerEnvironmentKeyTask implements Callable<Object> { @Override public Peer call() throws Exception { RelationLinkDto relationLinkDto = new RelationLinkDto( environment ); PublicKeyContainer publicKeyContainer = peer.createPeerEnvironmentKeyPair( relationLinkDto ); PGPPublicKeyRing pubRing = getPublicKey( publicKeyContainer ); PGPPublicKeyRing signedPEK = keyManager.setKeyTrust( envSecKeyRing, pubRing, KeyTrustLevel.FULL.getId() ); peer.updatePeerEnvironmentPubKey( environment.getEnvironmentId(), signedPEK ); peer.addPeerEnvironmentPubKey( localPeer.getId() + "_" + environment.getEnvironmentId().getId(), localPeerSignedPEK ); localPeer.addPeerEnvironmentPubKey( peer.getId() + "_" + environment.getEnvironmentId().getId(), signedPEK ); return peer; } PeerEnvironmentKeyTask( final LocalPeer localPeer, final PGPSecretKeyRing envSecKeyRing,
                                   final PGPPublicKeyRing localPeerSignedPEK, final Environment environment,
                                   final Peer peer, final KeyManager keyManager ); @Override Peer call();  }
@Test public void testCall() throws Exception { task.call(); verify( LOCAL_PEER ).addPeerEnvironmentPubKey( anyString(), any( PGPPublicKeyRing.class ) ); }