@@ -0,0 +1,1926 @@
+package com.google.bitcoin.examples;%0A%0Aimport com.google.bitcoin.core.*;%0Aimport com.google.bitcoin.kits.WalletAppKit;%0Aimport com.google.bitcoin.params.RegTestParams;%0Aimport com.google.bitcoin.utils.BriefLogFormatter;%0Aimport com.google.bitcoin.utils.Threading;%0A%0Aimport java.io.File;%0Aimport java.math.BigInteger;%0A%0A/**%0A * This is a little test app that waits for a coin on a local regtest node, then  generates two transactions that double%0A * spend the same output and sends them. It's useful for testing double spend codepaths but is otherwise not something%0A * you would normally want to do.%0A */%0Apublic class DoubleSpend %7B%0A    public static void main(String%5B%5D args) throws Exception %7B%0A        BriefLogFormatter.init();%0A        final RegTestParams params = RegTestParams.get();%0A        WalletAppKit kit = new WalletAppKit(params, new File(%22.%22), %22doublespend%22);%0A        kit.connectToLocalHost();%0A        kit.setAutoSave(false);%0A        kit.startAsync();%0A        kit.awaitRunning();%0A%0A        System.out.println(kit.wallet());%0A%0A        kit.wallet().getBalanceFuture(Utils.COIN, Wallet.BalanceType.AVAILABLE).get();%0A        Transaction tx1 = kit.wallet().createSend(new Address(params, %22muYPFNCv7KQEG2ZLM7Z3y96kJnNyXJ53wm%22), Utils.CENT);%0A        Transaction tx2 = kit.wallet().createSend(new Address(params, %22muYPFNCv7KQEG2ZLM7Z3y96kJnNyXJ53wm%22), Utils.CENT.add(BigInteger.TEN));%0A        final Peer peer = kit.peerGroup().getConnectedPeers().get(0);%0A        peer.addEventListener(new AbstractPeerEventListener() %7B%0A            @Override%0A            public Message onPreMessageReceived(Peer peer, Message m) %7B%0A                System.err.println(%22Got a message!%22 + m.getClass().getSimpleName() + %22: %22 + m);%0A                return m;%0A            %7D%0A        %7D, Threading.SAME_THREAD);%0A        peer.sendMessage(tx1);%0A        peer.sendMessage(tx2);%0A%0A        Thread.sleep(5000);%0A        kit.stopAsync();%0A        kit.awaitTerminated();%0A    %7D%0A%7D%0A

Add a double spending test program