From 5b45b0e65c019b25ac4ac7f9ce8ff4dd891ed3b5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 14 Jul 2015 19:39:00 +0200 Subject: [PATCH] Close fake server successfully when it was not used --- src/test/java/net/pterodactylus/fcp/fake/FakeTcpServer.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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(); + } } } -- 2.7.4