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 io.helidon.webclient.http1.Http1Client
PROTOCOL, PROTOCOL_ID -
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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.helidon.webclient.api.HttpClient
delete, delete, get, get, head, head, options, options, patch, patch, post, post, put, put, trace, traceMethods inherited from interface io.helidon.webclient.api.ReleasableResource
releaseResource
-
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.
-