@@ -0,0 +1,1678 @@
+/*%0A * To change this template, choose Tools %7C Templates%0A * and open the template in the editor.%0A */%0Apackage com.turn.ttorrent.client;%0A%0Aimport com.google.common.io.Files;%0Aimport com.google.common.io.Resources;%0Aimport com.turn.ttorrent.protocol.torrent.Torrent;%0Aimport com.turn.ttorrent.tracker.client.TorrentMetadataProvider;%0Aimport java.io.File;%0Aimport java.net.URL;%0Aimport java.util.concurrent.CountDownLatch;%0Aimport java.util.concurrent.TimeUnit;%0Aimport org.junit.Ignore;%0Aimport org.junit.Test;%0A%0A/**%0A *%0A * @author joel%0A */%0Apublic class UbuntuImageDownloadTest %7B%0A%0A    @Ignore%0A    @Test%0A    public void testDownloadImage() throws Exception %7B%0A        File torrentFile = File.createTempFile(%22ttorrent-ubuntu%22, %22.torrent%22);%0A        File image = File.createTempFile(%22ttorrent-ubuntu%22, %22.img%22);%0A        //TODO(jfriedly): Remove when this works.%0A        torrentFile.deleteOnExit();%0A        image.deleteOnExit();%0A        URL url = new URL(%22http://releases.ubuntu.com/14.10/ubuntu-14.10-desktop-amd64.iso.torrent%22);%0A        Resources.asByteSource(url).copyTo(Files.asByteSink(torrentFile));%0A%0A        Client c = new Client(null);%0A        Torrent torrent = new Torrent(torrentFile);%0A        c.addTorrent(torrent, image);%0A%0A        CountDownLatch latch = new CountDownLatch(1);%0A        c.addClientListener(new ReplicationCompletionListener(latch, TorrentMetadataProvider.State.SEEDING));%0A%0A        try %7B%0A            c.start();%0A            for (;;) %7B%0A                if (latch.await(10, TimeUnit.SECONDS))%0A                    break;%0A                c.info(true);%0A            %7D%0A        %7D finally %7B%0A            c.stop();%0A        %7D%0A%0A        torrentFile.delete();%0A        image.delete();%0A    %7D%0A%7D%0A

Add UbuntuImageDownloadTest