public final class Connection extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Connection.ConnectionBuilder |
Constructor and Description |
---|
Connection(String host,
int port,
int timeout,
Credentials credentials,
TLSConfig useTLS)
Create a
Connection |
Modifier and Type | Method and Description |
---|---|
static Connection.ConnectionBuilder |
builder() |
Credentials |
getCredentials()
The gRPC `Authentication` token.
|
String |
getHost()
The host to connect to.
|
int |
getPort()
The port to use.
|
int |
getTimeout()
The timeout for each request (in milliseconds).
|
TLSConfig |
getTlsConfig()
The
TLSConfig to use. |
static Connection.ConnectionBuilder |
newBuilder()
A connection builder to use with the
ClientV2
I.e. |
io.grpc.ManagedChannel |
newChannel()
Create the channel to be used based on the
Connection configuration. |
public Connection(String host, int port, int timeout, Credentials credentials, TLSConfig useTLS)
Connection
host
- the host to connect to.port
- the port to use.timeout
- the timeout for each request.credentials
- The Credentials
to use for the connection.
This includes the 'Authentication' header and
possibly additional HTTP headers.useTLS
- Whether to enforce the usage of TLS and use the specified TLS configuration.public static Connection.ConnectionBuilder newBuilder()
ClientV2
I.e. the GRPCv2 API.NoCredentialsConnectionBuilder
public io.grpc.ManagedChannel newChannel() throws IOException
Connection
configuration.ManagedChannel
IOException
public static Connection.ConnectionBuilder builder()
public String getHost()
public int getPort()
public int getTimeout()
public Credentials getCredentials()
public TLSConfig getTlsConfig()
TLSConfig
to use.
If this is not set i.e. 'null' then the underlying HTTP connection can fall back to 'plain-text'
if the servers certificate cannot be verified against the standard CA root.
Otherwise, if this is set then the connection will use the supplied TLSConfig
for
setting up trust and possibly mTLS. See TLSConfig
for more configuration details.
Copyright © 2025. All rights reserved.