Class TestServer

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class TestServer
    extends java.lang.Object
    implements java.lang.AutoCloseable
    A HTTP test server.
    • Constructor Summary

      Constructors 
      Constructor Description
      TestServer​(com.sun.net.httpserver.HttpHandler handler)  
      TestServer​(java.lang.String context, com.sun.net.httpserver.HttpHandler handler)  
      TestServer​(java.lang.String context, com.sun.net.httpserver.HttpHandler handler, java.util.function.Consumer<com.sun.net.httpserver.HttpsServer> init)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      java.net.InetSocketAddress getAddress()  
      java.net.URI getUri()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TestServer

        public TestServer​(java.lang.String context,
                          com.sun.net.httpserver.HttpHandler handler)
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • TestServer

        public TestServer​(java.lang.String context,
                          com.sun.net.httpserver.HttpHandler handler,
                          java.util.function.Consumer<com.sun.net.httpserver.HttpsServer> init)
                   throws java.io.IOException
        Constructor.
        Parameters:
        context - server context
        handler - http request handler
        init - init method (optional)
        Throws:
        java.io.IOException - maybe
      • TestServer

        public TestServer​(com.sun.net.httpserver.HttpHandler handler)
                   throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • getAddress

        public java.net.InetSocketAddress getAddress()
      • getUri

        public java.net.URI getUri()
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable