Class HttpTestServer

java.lang.Object
org.apache.hc.core5.testing.nio.AsyncServer
org.apache.hc.core5.testing.nio.HttpTestServer
All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
H2TestServer, Http1TestServer

public abstract class HttpTestServer extends AsyncServer
Since:
5.4
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    HttpTestServer(org.apache.hc.core5.reactor.IOReactorConfig ioReactorConfig, SSLContext sslContext, org.apache.hc.core5.reactor.ssl.SSLSessionInitializer sslSessionInitializer, org.apache.hc.core5.reactor.ssl.SSLSessionVerifier sslSessionVerifier)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    awaitShutdown(org.apache.hc.core5.util.TimeValue waitTime)
     
    void
     
    void
    configure(org.apache.hc.core5.function.Decorator<org.apache.hc.core5.http.nio.AsyncServerExchangeHandler> exchangeHandlerDecorator)
     
    void
    configure(org.apache.hc.core5.http.protocol.HttpProcessor httpProcessor)
     
    protected void
    execute(org.apache.hc.core5.reactor.IOEventHandlerFactory ioEventHandlerFactory)
     
    org.apache.hc.core5.reactor.IOReactorStatus
     
    void
     
    void
    register(String uriPattern, org.apache.hc.core5.function.Supplier<org.apache.hc.core5.http.nio.AsyncServerExchangeHandler> supplier)
     
    <T> void
    register(String uriPattern, org.apache.hc.core5.http.nio.AsyncServerRequestHandler<T> requestHandler)
     
    void
    shutdown(org.apache.hc.core5.util.TimeValue graceTime)
     
     
    startExecution(org.apache.hc.core5.reactor.IOEventHandlerFactory handlerFactory)
     

    Methods inherited from class AsyncServer

    getEndpoints, listen

    Methods inherited from class Object

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

    • HttpTestServer

      public HttpTestServer(org.apache.hc.core5.reactor.IOReactorConfig ioReactorConfig, SSLContext sslContext, org.apache.hc.core5.reactor.ssl.SSLSessionInitializer sslSessionInitializer, org.apache.hc.core5.reactor.ssl.SSLSessionVerifier sslSessionVerifier) throws IOException
      Throws:
      IOException
    • HttpTestServer

      public HttpTestServer() throws IOException
      Throws:
      IOException
  • Method Details

    • start

      public abstract InetSocketAddress start() throws Exception
      Throws:
      Exception
    • register

      public void register(String uriPattern, org.apache.hc.core5.function.Supplier<org.apache.hc.core5.http.nio.AsyncServerExchangeHandler> supplier)
    • register

      public <T> void register(String uriPattern, org.apache.hc.core5.http.nio.AsyncServerRequestHandler<T> requestHandler)
    • configure

      public void configure(org.apache.hc.core5.http.protocol.HttpProcessor httpProcessor)
    • configure

      public void configure(org.apache.hc.core5.function.Decorator<org.apache.hc.core5.http.nio.AsyncServerExchangeHandler> exchangeHandlerDecorator)
    • startExecution

      public InetSocketAddress startExecution(org.apache.hc.core5.reactor.IOEventHandlerFactory handlerFactory) throws Exception
      Throws:
      Exception
    • execute

      protected void execute(org.apache.hc.core5.reactor.IOEventHandlerFactory ioEventHandlerFactory) throws IOException
      Throws:
      IOException
    • getStatus

      public org.apache.hc.core5.reactor.IOReactorStatus getStatus()
    • awaitShutdown

      public void awaitShutdown(org.apache.hc.core5.util.TimeValue waitTime) throws InterruptedException
      Throws:
      InterruptedException
    • initiateShutdown

      public void initiateShutdown()
    • shutdown

      public void shutdown(org.apache.hc.core5.util.TimeValue graceTime)
    • close

      public void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception