Class EmbeddedJetty

java.lang.Object
net.shibboleth.shared.testing.EmbeddedJetty

public class EmbeddedJetty extends Object
Testing fixture using Jetty to server a specified handler.
  • Field Details

    • jettyListenAddrs

      private List<InetAddress> jettyListenAddrs
      Addresses to listen on.
    • port

      private int port
      TLS port
    • jettyServer

      @Nullable org.eclipse.jetty.server.Server jettyServer
      Captures server.
  • Constructor Details

    • EmbeddedJetty

      public EmbeddedJetty()
  • Method Details

    • setPort

      public void setPort(int p)
      Sets the TLS port to listen on.

      Defaults to 8443.

      Parameters:
      p - port
    • startServer

      public void startServer(org.eclipse.jetty.server.Handler handler) throws UnknownHostException, SocketException
      Starts embedded server to serve specified test content.

      The caller is expected to call stopServer() when finished.

      Parameters:
      handler -
      Throws:
      UnknownHostException
      SocketException
    • stopServer

      public void stopServer()
      Stop the server if started.
    • getServerCertficateResource

      @Nonnull public static Resource getServerCertficateResource()
      Returns the TLS certificate used by the server as a resource in PEM format
      Returns:
      TLS server certificate resource
    • resolveListenAddresses

      private void resolveListenAddresses() throws UnknownHostException, SocketException
      Resolve all applicable localhost interfaces.
      Throws:
      UnknownHostException
      SocketException