Class DirectWebClient
java.lang.Object
io.helidon.webserver.testing.junit5.DirectWebClient
- All Implemented Interfaces:
RuntimeType.Api<WebClientConfig>,HttpClient<HttpClientRequest>,ReleasableResource,WebClient
Unit testing client that bypasses HTTP transport and directly invokes router.
-
Constructor Summary
ConstructorsConstructorDescriptionDirectWebClient(HttpRouting.Builder routing) Create a direct client for HTTP routing. -
Method Summary
Modifier and TypeMethodDescription<T,C extends ProtocolConfig>
TTo switch to a non-HTTP protocol client (or a client of a specific HTTP version) using its config configured when creating the client, or default config if none configured.<T,C extends ProtocolConfig>
TTo switch to a non-HTTP protocol client (or a client of a specific HTTP version).clientHost(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.Cookie manager to use by this client.executor()Executor services, uses virtual threads.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
-
DirectWebClient
Create a direct client for HTTP routing.- Parameters:
routing- routing to use
-
-
Method Details
-
method
Description copied from interface:HttpClientCreate a request for a method.- Specified by:
methodin interfaceHttpClient<HttpClientRequest>- 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<HttpClientRequest>- Specified by:
closeResourcein interfaceReleasableResource
-
prototype
Description copied from interface:RuntimeType.ApiThe prototype as it was received when creating this runtime object instance.- Specified by:
prototypein interfaceRuntimeType.Api<WebClientConfig>- Returns:
- prototype object used to create this instance
-
client
Description copied from interface:WebClientTo switch to a non-HTTP protocol client (or a client of a specific HTTP version). The resulting protocol will use this client as a base, so it will share all configuration that is relevant for the protocol.- Specified by:
clientin interfaceWebClient- Type Parameters:
T- type of the protocol clientC- type of the protocol config- Parameters:
protocol- protocol instance, usually defined as a constant on the protocol interfaceprotocolConfig- configuration of the protocol to be used (if customization is required)- Returns:
- a new protocol client instance
-
client
Description copied from interface:WebClientTo switch to a non-HTTP protocol client (or a client of a specific HTTP version) using its config configured when creating the client, or default config if none configured. The resulting protocol will use this client as a base, so it will share all configuration that is relevant for the protocol. -
executor
Description copied from interface:WebClientExecutor services, uses virtual threads. -
cookieManager
Description copied from interface:WebClientCookie manager to use by this client.- Specified by:
cookieManagerin interfaceWebClient- Returns:
- cookie manager
-
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.
-