From 2a55c58460a167e3846a439f6f2aad98f1dc9bb2 Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Mon, 24 Dec 2012 21:27:49 +0000 Subject: [PATCH] Make PeerGroup startup blocking in the unit tests. --- .../java/com/google/bitcoin/core/PeerGroupTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/test/java/com/google/bitcoin/core/PeerGroupTest.java b/core/src/test/java/com/google/bitcoin/core/PeerGroupTest.java index d8908406..5ab8d22e 100644 --- a/core/src/test/java/com/google/bitcoin/core/PeerGroupTest.java +++ b/core/src/test/java/com/google/bitcoin/core/PeerGroupTest.java @@ -100,7 +100,7 @@ public class PeerGroupTest extends TestWithNetworkConnections { public void shutdown() { } }); - peerGroup.start(); + peerGroup.startAndWait(); sem.acquire(); // Check that we did indeed throw an exception. If we got here it means we threw and then PeerGroup tried // again a bit later. @@ -111,7 +111,7 @@ public class PeerGroupTest extends TestWithNetworkConnections { @Test public void receiveTxBroadcast() throws Exception { // Check that when we receive transactions on all our peers, we do the right thing. - peerGroup.start(); + peerGroup.startAndWait(); // Create a couple of peers. peerGroup.addWallet(wallet); @@ -156,7 +156,7 @@ public class PeerGroupTest extends TestWithNetworkConnections { @Test public void singleDownloadPeer1() throws Exception { // Check that we don't attempt to retrieve blocks on multiple peers. - peerGroup.start(); + peerGroup.startAndWait(); // Create a couple of peers. FakeChannel p1 = connectPeer(1); @@ -191,7 +191,7 @@ public class PeerGroupTest extends TestWithNetworkConnections { // Check that we don't attempt multiple simultaneous block chain downloads, when adding a new peer in the // middle of an existing chain download. // Create a couple of peers. - peerGroup.start(); + peerGroup.startAndWait(); // Create a couple of peers. FakeChannel p1 = connectPeer(1); @@ -372,7 +372,7 @@ public class PeerGroupTest extends TestWithNetworkConnections { @Test public void noPings() throws Exception { - peerGroup.start(); + peerGroup.startAndWait(); peerGroup.setPingIntervalMsec(0); VersionMessage versionMessage = new VersionMessage(params, 2); versionMessage.clientVersion = Pong.MIN_PROTOCOL_VERSION; @@ -382,7 +382,7 @@ public class PeerGroupTest extends TestWithNetworkConnections { @Test public void pings() throws Exception { - peerGroup.start(); + peerGroup.startAndWait(); peerGroup.setPingIntervalMsec(100); VersionMessage versionMessage = new VersionMessage(params, 2); versionMessage.clientVersion = Pong.MIN_PROTOCOL_VERSION;