@Test
public void invDownloadTxMultiPeer() throws Exception {

    // Check co-ordination of which peer to download via the memory pool.
    VersionMessage ver = new VersionMessage(PARAMS, 100);
    InetSocketAddress address = new InetSocketAddress("127.0.0.1", 4242);
    Peer peer2 = new Peer(PARAMS, ver, new PeerAddress(PARAMS, address), blockChain);
    peer2.addWallet(wallet);
    VersionMessage peerVersion = new VersionMessage(PARAMS, OTHER_PEER_CHAIN_HEIGHT);
    peerVersion.clientVersion = NetworkParameters.ProtocolVersion.MINIMUM.getBitcoinProtocolVersion();
    peerVersion.localServices = VersionMessage.NODE_NETWORK;
    connect();
    InboundMessageQueuer writeTarget2 = connect(peer2, peerVersion);
    // Make a tx and advertise it to one of the peers.
    Coin value = COIN;
    Transaction tx = createFakeTx(PARAMS, value, this.address);
    InventoryMessage inv = new InventoryMessage(PARAMS);
    InventoryItem item = new InventoryItem(InventoryItem.Type.Transaction, tx.getHash());
    inv.addItem(item);
    inbound(writeTarget, inv);
    // We got a getdata message.
    GetDataMessage message = (GetDataMessage)outbound(writeTarget);
    assertEquals(1, message.getItems().size());
    assertEquals(tx.getHash(), message.getItems().get(0).hash);
    assertNotEquals(0, tx.getConfidence().numBroadcastPeers());
    // Advertising to peer2 results in no getdata message.
    inbound(writeTarget2, inv);
    pingAndWait(writeTarget2);
    assertNull(outbound(writeTarget2));
}