Fix killing of the test mail reciever
authorFelix Dörre <felix@dogcraft.de>
Thu, 3 Jul 2014 23:29:27 +0000 (01:29 +0200)
committerFelix Dörre <felix@dogcraft.de>
Thu, 3 Jul 2014 23:29:27 +0000 (01:29 +0200)
tests/org/cacert/gigi/testUtils/ManagedTest.java
tests/org/cacert/gigi/testUtils/TestEmailReciever.java

index 9b77f87c1e0ba64445394ce0267e67dd7fdc4252..a9e1001569763b24bb0885011e9510e3521ed509 100644 (file)
@@ -139,12 +139,12 @@ public class ManagedTest {
        @AfterClass
        public static void tearDownServer() {
                String type = testProps.getProperty("type");
+               ter.destroy();
                if (type.equals("local")) {
                        return;
                }
                gigi.destroy();
        }
-
        @After
        public void removeMails() {
                ter.reset();
index 58b4b89ce6b441533f089d1164298384524a299f..d9ffdf3fd97bbea4548638c97f392827adc2e32a 100644 (file)
@@ -92,7 +92,9 @@ public class TestEmailReciever implements Runnable {
                                }
                        }
                } catch (IOException e) {
-                       e.printStackTrace();
+                       if (!closed) {
+                               e.printStackTrace();
+                       }
                }
 
        }
@@ -108,5 +110,14 @@ public class TestEmailReciever implements Runnable {
                clearMails();
                approveRegex = Pattern.compile(".*");
        }
+       boolean closed = false;
+       public void destroy() {
+               try {
+                       closed = true;
+                       s.close();
+               } catch (IOException e) {
+                       e.printStackTrace();
+               }
+       }
 
 }