java.lang.Object
io.helidon.webserver.testing.junit5.DirectClient
All Implemented Interfaces:
RuntimeType.Api<Http1ClientConfig>, HttpClient<Http1ClientRequest>, ReleasableResource, Http1Client

public class DirectClient extends Object implements Http1Client
Unit testing client that bypasses HTTP transport and directly invokes router.
  • Constructor Details

    • DirectClient

      public DirectClient(HttpRouting.Builder routing)
      Create a direct client for HTTP routing.
      Parameters:
      routing - routing to use
  • Method Details

    • prototype

      public Http1ClientConfig prototype()
      Description copied from interface: RuntimeType.Api
      The prototype as it was received when creating this runtime object instance.
      Specified by:
      prototype in interface RuntimeType.Api<Http1ClientConfig>
      Returns:
      prototype object used to create this instance
    • method

      public Http1ClientRequest method(Method method)
      Description copied from interface: HttpClient
      Create a request for a method.
      Specified by:
      method in interface HttpClient<Http1ClientRequest>
      Parameters:
      method - HTTP method
      Returns:
      a new request (not thread safe)
    • closeResource

      public void closeResource()
      Description copied from interface: HttpClient
      Gracefully close all opened client specific connections.
      Specified by:
      closeResource in interface HttpClient<Http1ClientRequest>
      Specified by:
      closeResource in interface ReleasableResource
    • setTls

      public DirectClient setTls(boolean tls)
      Whether to use tls (mark this connection as secure).
      Parameters:
      tls - use tls
      Returns:
      updated client
    • clientHost

      public DirectClient clientHost(String clientHost)
      Client host.
      Parameters:
      clientHost - client host to use in PeerInfo
      Returns:
      updated client
    • clientPort

      public DirectClient clientPort(int clientPort)
      Client port.
      Parameters:
      clientPort - client port to use in PeerInfo
      Returns:
      updated client
    • clientTlsPrincipal

      public DirectClient clientTlsPrincipal(Principal clientTlsPrincipal)
      Client peer TLS principal.
      Parameters:
      clientTlsPrincipal - principal to use in PeerInfo
      Returns:
      updated client
    • clientTlsCertificates

      public DirectClient clientTlsCertificates(Certificate[] clientTlsCertificates)
      Client peer TLS certificates.
      Parameters:
      clientTlsCertificates - certificates to use in PeerInfo
      Returns:
      updated client
    • serverHost

      public DirectClient serverHost(String serverHost)
      Server host.
      Parameters:
      serverHost - server host to use in PeerInfo
      Returns:
      updated client
    • serverPort

      public DirectClient serverPort(int serverPort)
      Server port.
      Parameters:
      serverPort - server port to use in PeerInfo
      Returns:
      updated client
    • serverTlsPrincipal

      public DirectClient serverTlsPrincipal(Principal serverTlsPrincipal)
      Server TLS principal.
      Parameters:
      serverTlsPrincipal - principal to use in PeerInfo
      Returns:
      updated client
    • serverTlsCertificates

      public DirectClient serverTlsCertificates(Certificate[] serverTlsCertificates)
      Server TLS certificates.
      Parameters:
      serverTlsCertificates - certificates to use in PeerInfo
      Returns:
      updated client
    • close

      public void close()
      Call this method once testing is done, to carry out after stop operations on routers.