[java-shib-shared] 02/02: Support Closeable in EmbeddedJetty fixture.

Codeberg noreply at shibboleth.net
Wed Jul 8 18:19:02 UTC 2026


This is an automated email from the git hooks/post-receive script.

codeberg pushed a commit to branch main
in repository java-shib-shared.

View the commit online:
https://codeberg.org/Shibboleth/java-shib-shared/commit/50f2951f2b17fef459dc80ade5447912ef6bbb01

commit 50f2951f2b17fef459dc80ade5447912ef6bbb01
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Wed Jul 8 14:18:51 2026 -0400

    Support Closeable in EmbeddedJetty fixture.
---
 .../java/net/shibboleth/shared/testing/EmbeddedJetty.java  | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/shib-testing/src/main/java/net/shibboleth/shared/testing/EmbeddedJetty.java b/shib-testing/src/main/java/net/shibboleth/shared/testing/EmbeddedJetty.java
index e6665fe7..cd7c88f4 100644
--- a/shib-testing/src/main/java/net/shibboleth/shared/testing/EmbeddedJetty.java
+++ b/shib-testing/src/main/java/net/shibboleth/shared/testing/EmbeddedJetty.java
@@ -14,6 +14,8 @@
 
 package net.shibboleth.shared.testing;
 
+import java.io.Closeable;
+import java.io.IOException;
 import java.net.InetAddress;
 import java.net.InterfaceAddress;
 import java.net.NetworkInterface;
@@ -48,9 +50,9 @@ import net.shibboleth.shared.resource.Resource;
 import net.shibboleth.shared.spring.resource.ResourceHelper;
 
 /**
- * Testing fixture using Jetty to serve a specified handler.
+ * Testing fixture using Jetty to server a specified handler.
  */
-public class EmbeddedJetty {
+public class EmbeddedJetty implements Closeable {
 
     /** Addresses to listen on. */
     private List<InetAddress> jettyListenAddrs;
@@ -128,13 +130,17 @@ public class EmbeddedJetty {
         if (jettyServer != null) {
             try {
                 jettyServer.stop();
-                jettyServer = null;
             } catch (final Exception e) {
                 throw new RuntimeException("Jetty stop failed", e);
             }
         }
     }
     
+    /** {@inheritDoc} */
+    public void close() throws IOException {
+        stopServer();
+    }
+    
     /**
      * Returns the TLS certificate used by the server as a resource in PEM format
      * 
@@ -145,7 +151,7 @@ public class EmbeddedJetty {
     }    
     
     /**
-     * Jetty handler to serve content.
+     * Jetty handler to server content.
      */
     public static class ResourceHandler extends Handler.Abstract {
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list