Add close() method, implement AutoCloseable
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Wed, 1 Jul 2015 19:27:16 +0000 (21:27 +0200)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Wed, 1 Jul 2015 19:27:16 +0000 (21:27 +0200)
src/test/java/net/pterodactylus/fcp/fake/FakeTcpServer.java

index 07afb24..6b3674a 100644 (file)
@@ -15,7 +15,7 @@ import org.hamcrest.Matcher;
  *
  * @author <a href="bombe@freenetproject.org">David ‘Bombe’ Roden</a>
  */
-public class FakeTcpServer {
+public class FakeTcpServer implements AutoCloseable {
 
        private final ServerSocket serverSocket;
        private final ExecutorService executorService;
@@ -52,4 +52,9 @@ public class FakeTcpServer {
                return clientSocket.get().readLine();
        }
 
+       @Override
+       public void close() throws IOException {
+               clientSocket.get().close();
+       }
+
 }