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
ConstructorDescriptionDirectClient
(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.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.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
-
DirectClient
Create a direct client for HTTP routing.- Parameters:
routing
- routing to use
-
-
Method Details
-
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<Http1ClientConfig>
- Returns:
- prototype object used to create this instance
-
method
Description copied from interface:HttpClient
Create a request for a method.- Specified by:
method
in interfaceHttpClient<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 interfaceHttpClient<Http1ClientRequest>
- Specified by:
closeResource
in 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.
-