From 0325bba86cbcbb18193cec66145a0ff5e54f0907 Mon Sep 17 00:00:00 2001
From: akwizgran <akwizgran@users.sourceforge.net>
Date: Fri, 22 Nov 2013 12:56:42 +0000
Subject: [PATCH] Fixed some resource leak warnings in unit tests.

Four more warnings were left unfixed because quick fixes would've broken
the tests.
---
 .../src/net/sf/briar/transport/ConnectionReaderImplTest.java  | 4 ++++
 .../src/net/sf/briar/transport/TransportIntegrationTest.java  | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/briar-tests/src/net/sf/briar/transport/ConnectionReaderImplTest.java b/briar-tests/src/net/sf/briar/transport/ConnectionReaderImplTest.java
index 4bec12fc63..0d91a57b22 100644
--- a/briar-tests/src/net/sf/briar/transport/ConnectionReaderImplTest.java
+++ b/briar-tests/src/net/sf/briar/transport/ConnectionReaderImplTest.java
@@ -34,6 +34,7 @@ public class ConnectionReaderImplTest extends BriarTestCase {
 		assertEquals(-1, c.read()); // Skip the second empty frame, reach EOF
 		assertEquals(-1, c.read()); // Still at EOF
 		context.assertIsSatisfied();
+		c.close();
 	}
 
 	@Test
@@ -59,6 +60,7 @@ public class ConnectionReaderImplTest extends BriarTestCase {
 		// Still at EOF
 		assertEquals(-1, c.read(buf));
 		context.assertIsSatisfied();
+		c.close();
 	}
 
 	@Test
@@ -80,6 +82,7 @@ public class ConnectionReaderImplTest extends BriarTestCase {
 		// Reach EOF
 		assertEquals(-1, c.read(buf, 0, buf.length));
 		context.assertIsSatisfied();
+		c.close();
 	}
 
 	@Test
@@ -103,5 +106,6 @@ public class ConnectionReaderImplTest extends BriarTestCase {
 		// Reach EOF
 		assertEquals(-1, c.read(buf, 0, buf.length));
 		context.assertIsSatisfied();
+		c.close();
 	}
 }
diff --git a/briar-tests/src/net/sf/briar/transport/TransportIntegrationTest.java b/briar-tests/src/net/sf/briar/transport/TransportIntegrationTest.java
index 331d224388..d28713e4d5 100644
--- a/briar-tests/src/net/sf/briar/transport/TransportIntegrationTest.java
+++ b/briar-tests/src/net/sf/briar/transport/TransportIntegrationTest.java
@@ -121,6 +121,8 @@ public class TransportIntegrationTest extends BriarTestCase {
 		}
 		assertEquals(recovered1.length, offset);
 		assertArrayEquals(frame1, recovered1);
+		writer.close();
+		reader.close();
 	}
 
 	@Test
-- 
GitLab