diff --git a/test/net/sf/briar/LockFairnessTest.java b/test/net/sf/briar/LockFairnessTest.java
index 7a798d40d9c8b2c2178e1cf2858630a94e964978..7686d4bd11fdc959af2016f751ff26979de646cd 100644
--- a/test/net/sf/briar/LockFairnessTest.java
+++ b/test/net/sf/briar/LockFairnessTest.java
@@ -20,7 +20,7 @@ public class LockFairnessTest extends BriarTestCase {
 		Thread shortReader = new ReaderThread(lock, 1);
 		// The short-running reader should complete before the long-running one
 		longReader.start();
-		Thread.sleep(1);
+		Thread.sleep(10);
 		shortReader.start();
 		// Wait for the long-running reader to finish (it should finish last)
 		longReader.join();
@@ -40,9 +40,9 @@ public class LockFairnessTest extends BriarTestCase {
 		// The short-running reader should not overtake the writer and share
 		// the lock with the long-running reader
 		longReader.start();
-		Thread.sleep(1);
+		Thread.sleep(10);
 		writer.start();
-		Thread.sleep(1);
+		Thread.sleep(10);
 		shortReader.start();
 		// Wait for the short-running reader to finish (it should finish last)
 		shortReader.join();
diff --git a/test/net/sf/briar/db/H2DatabaseTest.java b/test/net/sf/briar/db/H2DatabaseTest.java
index d171e56cdfd0885427342946f998bd2e2df72078..cbc223c06f1192fe437461640e9a156bd710408e 100644
--- a/test/net/sf/briar/db/H2DatabaseTest.java
+++ b/test/net/sf/briar/db/H2DatabaseTest.java
@@ -945,7 +945,8 @@ public class H2DatabaseTest extends BriarTestCase {
 
 	@Test
 	public void testCloseWaitsForCommit() throws Exception {
-		final CountDownLatch latch = new CountDownLatch(1);
+		final CountDownLatch closing = new CountDownLatch(1);
+		final CountDownLatch closed = new CountDownLatch(1);
 		final AtomicBoolean transactionFinished = new AtomicBoolean(false);
 		final AtomicBoolean error = new AtomicBoolean(false);
 		final Database<Connection> db = open(false);
@@ -953,32 +954,35 @@ public class H2DatabaseTest extends BriarTestCase {
 		// Start a transaction
 		Connection txn = db.startTransaction();
 		// In another thread, close the database
-		Thread t = new Thread() {
+		Thread close = new Thread() {
 			public void run() {
 				try {
+					closing.countDown();
 					db.close();
 					if(!transactionFinished.get()) error.set(true);
-					latch.countDown();
+					closed.countDown();
 				} catch(Exception e) {
 					error.set(true);
 				}
 			}
 		};
-		t.start();
+		close.start();
+		closing.await();
 		// Do whatever the transaction needs to do
 		Thread.sleep(10);
 		transactionFinished.set(true);
 		// Commit the transaction
 		db.commitTransaction(txn);
 		// The other thread should now terminate
-		assertTrue(latch.await(5, TimeUnit.SECONDS));
+		assertTrue(closed.await(5, TimeUnit.SECONDS));
 		// Check that the other thread didn't encounter an error
 		assertFalse(error.get());
 	}
 
 	@Test
 	public void testCloseWaitsForAbort() throws Exception {
-		final CountDownLatch latch = new CountDownLatch(1);
+		final CountDownLatch closing = new CountDownLatch(1);
+		final CountDownLatch closed = new CountDownLatch(1);
 		final AtomicBoolean transactionFinished = new AtomicBoolean(false);
 		final AtomicBoolean error = new AtomicBoolean(false);
 		final Database<Connection> db = open(false);
@@ -986,25 +990,27 @@ public class H2DatabaseTest extends BriarTestCase {
 		// Start a transaction
 		Connection txn = db.startTransaction();
 		// In another thread, close the database
-		Thread t = new Thread() {
+		Thread close = new Thread() {
 			public void run() {
 				try {
+					closing.countDown();
 					db.close();
 					if(!transactionFinished.get()) error.set(true);
-					latch.countDown();
+					closed.countDown();
 				} catch(Exception e) {
 					error.set(true);
 				}
 			}
 		};
-		t.start();
+		close.start();
+		closing.await();
 		// Do whatever the transaction needs to do
 		Thread.sleep(10);
 		transactionFinished.set(true);
 		// Abort the transaction
 		db.abortTransaction(txn);
 		// The other thread should now terminate
-		assertTrue(latch.await(5, TimeUnit.SECONDS));
+		assertTrue(closed.await(5, TimeUnit.SECONDS));
 		// Check that the other thread didn't encounter an error
 		assertFalse(error.get());
 	}
diff --git a/test/net/sf/briar/plugins/file/PollingRemovableDriveMonitorTest.java b/test/net/sf/briar/plugins/file/PollingRemovableDriveMonitorTest.java
index f3659ea3ad7ba3236a90d312154ea64df1477ec4..f2d7a65dfca37646d74e7a564650db76d7b749fe 100644
--- a/test/net/sf/briar/plugins/file/PollingRemovableDriveMonitorTest.java
+++ b/test/net/sf/briar/plugins/file/PollingRemovableDriveMonitorTest.java
@@ -81,7 +81,7 @@ public class PollingRemovableDriveMonitorTest extends BriarTestCase {
 				fail();
 			}
 		});
-		Thread.sleep(50);
+		Thread.sleep(100);
 		// The monitor should rethrow the exception when it stops
 		try {
 			monitor.stop();
diff --git a/test/net/sf/briar/plugins/socket/SimpleSocketPluginTest.java b/test/net/sf/briar/plugins/socket/SimpleSocketPluginTest.java
index cf4cb3fca9b03b8f342f09108584113096d66e17..23e6381103d574657e5f5b33a2dba58effe4faec 100644
--- a/test/net/sf/briar/plugins/socket/SimpleSocketPluginTest.java
+++ b/test/net/sf/briar/plugins/socket/SimpleSocketPluginTest.java
@@ -47,12 +47,12 @@ public class SimpleSocketPluginTest extends BriarTestCase {
 		Socket s = new Socket();
 		assertEquals(0, callback.incomingConnections);
 		s.connect(addr, 100);
-		Thread.sleep(100);
+		Thread.sleep(200);
 		assertEquals(1, callback.incomingConnections);
 		s.close();
 		// Stop the plugin
 		plugin.stop();
-		Thread.sleep(100);
+		Thread.sleep(200);
 		// The plugin should no longer be listening
 		try {
 			s = new Socket();