@Test
public void getBlock() throws Exception {

    connect();
    Block b1 = createFakeBlock(blockStore, Block.BLOCK_HEIGHT_GENESIS).block;
    blockChain.add(b1);
    Block b2 = makeSolvedTestBlock(b1);
    Block b3 = makeSolvedTestBlock(b2);
    // Request the block.
    Future<Block> resultFuture = peer.getBlock(b3.getHash());
    assertFalse(resultFuture.isDone());
    // Peer asks for it.
    GetDataMessage message = (GetDataMessage) outbound(writeTarget);
    assertEquals(message.getItems().get(0).hash, b3.getHash());
    assertFalse(resultFuture.isDone());
    // Peer receives it.
    inbound(writeTarget, b3);
    Block b = resultFuture.get();
    assertEquals(b, b3);
}