@Test public void cancel() { final SignedBeaconBlock block = dataStructureUtil.randomSignedBeaconBlock(10); final Bytes32 blockRoot = block.getMessage().hash_tree_root(); FetchBlockTask task = FetchBlockTask.create(eth2Network, blockRoot); final Eth2Peer peer = registerNewPeer(1); when(peer.requestBlockByRoot(blockRoot)).thenReturn(SafeFuture.completedFuture(block)); task.cancel(); final SafeFuture<FetchBlockResult> result = task.run(); assertThat(result).isDone(); final FetchBlockResult fetchBlockResult = result.getNow(null); assertThat(fetchBlockResult.isSuccessful()).isFalse(); assertThat(fetchBlockResult.getStatus()).isEqualTo(Status.CANCELLED); }
public void cancel() { cancelled.set(true); }
FetchBlockTask { public void cancel() { cancelled.set(true); } }
FetchBlockTask { public void cancel() { cancelled.set(true); } FetchBlockTask(final P2PNetwork<Eth2Peer> eth2Network, final Bytes32 blockRoot); }
FetchBlockTask { public void cancel() { cancelled.set(true); } FetchBlockTask(final P2PNetwork<Eth2Peer> eth2Network, final Bytes32 blockRoot); void cancel(); static FetchBlockTask create(
      final P2PNetwork<Eth2Peer> eth2Network, final Bytes32 blockRoot); Bytes32 getBlockRoot(); int getNumberOfRetries(); SafeFuture<FetchBlockResult> run(); }
FetchBlockTask { public void cancel() { cancelled.set(true); } FetchBlockTask(final P2PNetwork<Eth2Peer> eth2Network, final Bytes32 blockRoot); void cancel(); static FetchBlockTask create(
      final P2PNetwork<Eth2Peer> eth2Network, final Bytes32 blockRoot); Bytes32 getBlockRoot(); int getNumberOfRetries(); SafeFuture<FetchBlockResult> run();  }