Package net.shibboleth.shared.testing
Class EmbeddedJetty
java.lang.Object
net.shibboleth.shared.testing.EmbeddedJetty
Testing fixture using Jetty to server a specified handler.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classJetty handler to server content. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<InetAddress>Addresses to listen on.(package private) org.eclipse.jetty.server.ServerCaptures server.private intTLS port -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ResourceReturns the TLS certificate used by the server as a resource in PEM formatprivate voidResolve all applicable localhost interfaces.voidsetPort(int p) Sets the TLS port to listen on.voidstartServer(org.eclipse.jetty.server.Handler handler) Starts embedded server to serve specified test content.voidStop the server if started.
-
Field Details
-
jettyListenAddrs
Addresses to listen on. -
port
private int portTLS port -
jettyServer
@Nullable org.eclipse.jetty.server.Server jettyServerCaptures 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:
UnknownHostExceptionSocketException
-
stopServer
public void stopServer()Stop the server if started. -
getServerCertficateResource
Returns the TLS certificate used by the server as a resource in PEM format- Returns:
- TLS server certificate resource
-
resolveListenAddresses
Resolve all applicable localhost interfaces.- Throws:
UnknownHostExceptionSocketException
-