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
ConstructorDescriptionDirectWebClient
(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.void
close()
Call this method once testing is done, to carry out after stop operations on routers.void
Gracefully 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, wait
Methods inherited from interface io.helidon.webclient.api.HttpClient
delete, delete, get, get, head, head, options, options, patch, patch, post, post, put, put, trace, trace
Methods 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:HttpClient
Create a request for a method.- Specified by:
method
in interfaceHttpClient<HttpClientRequest>
- 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 interfaceHttpClient<HttpClientRequest>
- Specified by:
closeResource
in interfaceReleasableResource
-
prototype
Description copied from interface:RuntimeType.Api
The prototype as it was received when creating this runtime object instance.- Specified by:
prototype
in interfaceRuntimeType.Api<WebClientConfig>
- Returns:
- prototype object used to create this instance
-
client
Description copied from interface:WebClient
To 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:
client
in 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:WebClient
To 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:WebClient
Executor services, uses virtual threads. -
cookieManager
Description copied from interface:WebClient
Cookie manager to use by this client.- Specified by:
cookieManager
in 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.
-