From: David ‘Bombe’ Roden Date: Tue, 14 Jul 2015 17:39:00 +0000 (+0200) Subject: Close fake server successfully when it was not used X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=5b45b0e65c019b25ac4ac7f9ce8ff4dd891ed3b5;p=jFCPlib.git Close fake server successfully when it was not used --- diff --git a/src/test/java/net/pterodactylus/fcp/fake/FakeTcpServer.java b/src/test/java/net/pterodactylus/fcp/fake/FakeTcpServer.java index 67a1fdc..c8edbbe 100644 --- a/src/test/java/net/pterodactylus/fcp/fake/FakeTcpServer.java +++ b/src/test/java/net/pterodactylus/fcp/fake/FakeTcpServer.java @@ -3,7 +3,6 @@ package net.pterodactylus.fcp.fake; import java.io.IOException; import java.net.ServerSocket; import java.util.List; -import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; import java.util.concurrent.atomic.AtomicReference; @@ -53,7 +52,10 @@ public class FakeTcpServer implements AutoCloseable { @Override public void close() throws IOException { - clientSocket.get().close(); + TextSocket textSocket = clientSocket.get(); + if (textSocket != null) { + textSocket.close(); + } } }