summary refs log tree commit diff
path: root/crypto/test
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2017-03-22 23:43:22 +1030
committerPeter Dettman <peter.dettman@bouncycastle.org>2017-03-22 23:43:22 +1030
commitbb077227fa263bed86980f8cc6aa6d4631c5010e (patch)
tree670bbf9bfe2ef73d7e73187fc3fe2072d1871f4a /crypto/test
parentRecords with ContentType.heartbeat should give 'unexpected_message' (diff)
downloadBouncyCastle.NET-ed25519-bb077227fa263bed86980f8cc6aa6d4631c5010e.tar.xz
Stop TcpListener in TlsServerTest
Diffstat (limited to 'crypto/test')
-rw-r--r--crypto/test/src/crypto/tls/test/TlsServerTest.cs21
1 files changed, 14 insertions, 7 deletions
diff --git a/crypto/test/src/crypto/tls/test/TlsServerTest.cs b/crypto/test/src/crypto/tls/test/TlsServerTest.cs
index 77adf22f7..7920cb59a 100644
--- a/crypto/test/src/crypto/tls/test/TlsServerTest.cs
+++ b/crypto/test/src/crypto/tls/test/TlsServerTest.cs
@@ -26,14 +26,21 @@ namespace Org.BouncyCastle.Crypto.Tls.Tests
             TcpListener ss = new TcpListener(IPAddress.Any, port);
             ss.Start();
             Stream stdout = Console.OpenStandardOutput();
-            while (true)
+            try
             {
-                TcpClient s = ss.AcceptTcpClient();
-                Console.WriteLine("--------------------------------------------------------------------------------");
-                Console.WriteLine("Accepted " + s);
-                ServerThread st = new ServerThread(s, stdout);
-                Thread t = new Thread(new ThreadStart(st.Run));
-                t.Start();
+                while (true)
+                {
+                    TcpClient s = ss.AcceptTcpClient();
+                    Console.WriteLine("--------------------------------------------------------------------------------");
+                    Console.WriteLine("Accepted " + s);
+                    ServerThread st = new ServerThread(s, stdout);
+                    Thread t = new Thread(new ThreadStart(st.Run));
+                    t.Start();
+                }
+            }
+            finally
+            {
+                ss.Stop();
             }
         }