Class DirectClient
java.lang.Object
io.helidon.webserver.testing.junit5.DirectClient
- All Implemented Interfaces:
RuntimeType.Api<Http1ClientConfig>, HttpClient<Http1ClientRequest>, ReleasableResource, Http1Client
Unit testing client that bypasses HTTP transport and directly invokes router.
-
Field Summary
Fields inherited from interface Http1Client
PROTOCOL, PROTOCOL_IDModifier and TypeFieldDescriptionstatic final Protocol<Http1Client, Http1ClientProtocolConfig> HTTP/1.1 protocol to use to obtain an instance of HTTP/1.1 specific client fromWebClient.client(io.helidon.webclient.spi.Protocol).static final StringID of HTTP/1.1 protocol, as used for example in ALPN. -
Constructor Summary
ConstructorsConstructorDescriptionDirectClient(HttpRouting.Builder routing) Create a direct client for HTTP routing. -
Method Summary
Modifier and TypeMethodDescriptionclientHost(String clientHost) Client host.clientPort(int clientPort) Client port.clientTlsCertificates(Certificate[] clientTlsCertificates) Client peer TLS certificates.clientTlsPrincipal(Principal clientTlsPrincipal) Client peer TLS principal.voidclose()Call this method once testing is done, to carry out after stop operations on routers.voidGracefully close all opened client specific connections.Create a request for a method.The prototype as it was received when creating this runtime object instance.serverHost(String serverHost) Server host.serverPort(int serverPort) Server port.serverTlsCertificates(Certificate[] serverTlsCertificates) Server TLS certificates.serverTlsPrincipal(Principal serverTlsPrincipal) Server TLS principal.setTls(boolean tls) Whether to use tls (mark this connection as secure).Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface HttpClient
delete, delete, get, get, head, head, options, options, patch, patch, post, post, put, put, trace, traceModifier and TypeMethodDescriptiondefault Http1ClientRequestdelete()Shortcut for delete method with default path.default Http1ClientRequestShortcut for delete method with a path.default Http1ClientRequestget()Shortcut for get method with default path.default Http1ClientRequestShortcut for get method with a path.default Http1ClientRequesthead()Shortcut for head method with default path.default Http1ClientRequestShortcut for head method with a path.default Http1ClientRequestoptions()Shortcut for options method with default path.default Http1ClientRequestShortcut for options method with a path.default Http1ClientRequestpatch()Shortcut for patch method with default path.default Http1ClientRequestShortcut for patch method with a path.default Http1ClientRequestpost()Shortcut for post method with default path.default Http1ClientRequestShortcut for post method with a path.default Http1ClientRequestput()Shortcut for put method with default path.default Http1ClientRequestShortcut for put method with a path.default Http1ClientRequesttrace()Shortcut for trace method with default path.default Http1ClientRequestShortcut for trace method with a path.Methods inherited from interface ReleasableResource
releaseResourceModifier and TypeMethodDescriptiondefault voidReleases the resource, and if this resource is re-usable, enabled reuse.
-
Constructor Details
-
DirectClient
Create a direct client for HTTP routing.- Parameters:
routing- routing to use
-
-
Method Details
-
prototype
Description copied from interface:RuntimeType.ApiThe prototype as it was received when creating this runtime object instance.- Specified by:
prototypein interfaceRuntimeType.Api<Http1ClientConfig>- Returns:
- prototype object used to create this instance
-
method
Description copied from interface:HttpClientCreate a request for a method.- Specified by:
methodin interfaceHttpClient<Http1ClientRequest>- Parameters:
method- HTTP method- Returns:
- a new request (not thread safe)
-
closeResource
public void closeResource()Description copied from interface:HttpClientGracefully close all opened client specific connections.- Specified by:
closeResourcein interfaceHttpClient<Http1ClientRequest>- Specified by:
closeResourcein interfaceReleasableResource
-
setTls
Whether to use tls (mark this connection as secure).- Parameters:
tls- use tls- Returns:
- updated client
-
clientHost
Client host.- Parameters:
clientHost- client host to use inPeerInfo- Returns:
- updated client
-
clientPort
Client port.- Parameters:
clientPort- client port to use inPeerInfo- Returns:
- updated client
-
clientTlsPrincipal
Client peer TLS principal.- Parameters:
clientTlsPrincipal- principal to use inPeerInfo- Returns:
- updated client
-
clientTlsCertificates
Client peer TLS certificates.- Parameters:
clientTlsCertificates- certificates to use inPeerInfo- Returns:
- updated client
-
serverHost
Server host.- Parameters:
serverHost- server host to use inPeerInfo- Returns:
- updated client
-
serverPort
Server port.- Parameters:
serverPort- server port to use inPeerInfo- Returns:
- updated client
-
serverTlsPrincipal
Server TLS principal.- Parameters:
serverTlsPrincipal- principal to use inPeerInfo- Returns:
- updated client
-
serverTlsCertificates
Server TLS certificates.- Parameters:
serverTlsCertificates- certificates to use inPeerInfo- Returns:
- updated client
-
close
public void close()Call this method once testing is done, to carry out after stop operations on routers.
-