Package com.kristensoft.kdc
Class ClientParameters.Builder<T extends ClientParameters.Builder<T>>
- java.lang.Object
-
- com.kristensoft.kdc.Parameters.Builder<T>
-
- com.kristensoft.kdc.ClientParameters.Builder<T>
-
- Type Parameters:
T- the protocol-specific builder type.
- Direct Known Subclasses:
KristenHttpClientParameters.Builder,MulticastParameters.Builder,TcpClientParameters.Builder,UdpClientParameters.Builder
- Enclosing class:
- ClientParameters
public abstract static class ClientParameters.Builder<T extends ClientParameters.Builder<T>> extends Parameters.Builder<T>
Base builder for configuring client parameters. Provides common client configuration used by protocol-specific client parameter builders.
-
-
Constructor Summary
Constructors Constructor Description Builder()Creates a builder for configuring client parameters.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract ClientParametersbuild()Builds the client parameters using the current builder configuration.TwithRemoteAddress(int port)Sets the remote address to the local loopback address using the specified port.TwithRemoteAddress(String host, int port)Sets the remote address using the specified host and port.TwithRemoteAddress(InetAddress address, int port)Sets the remote address using the specified network address and port.TwithRemoteAddress(InetSocketAddress remoteAddress)Sets the remote address to which the client will connect.TwithSendSyncTimeout(long replyWaitTime)Sets the amount of time a synchronous send waits for a reply before timing out.-
Methods inherited from class com.kristensoft.kdc.Parameters.Builder
addWhiteListEntry, registerApi, registerApi, registerApis, withAutoStart, withBindAddress, withBindAddress, withBindAddress, withCompressed, withConnectionQueuePoolSize, withCrc, withEncryptionKey, withLatencyMode, withLatencyReportingInterval, withMaxReceivedBufferSize, withMaxSendBufferSize, withSerializationFormat, withWhiteList
-
-
-
-
Method Detail
-
withRemoteAddress
public T withRemoteAddress(InetSocketAddress remoteAddress)
Sets the remote address to which the client will connect.- Parameters:
remoteAddress- the remote socket address.- Returns:
- this builder.
- Throws:
IllegalArgumentException- ifremoteAddressisnull.
-
withRemoteAddress
public T withRemoteAddress(String host, int port)
Sets the remote address using the specified host and port.- Parameters:
host- the remote host name or IP address.port- the remote port, from 0 through 65535.- Returns:
- this builder.
- Throws:
IllegalArgumentException- ifhostisnull, or ifportis outside the range 0 through 65535.
-
withRemoteAddress
public T withRemoteAddress(InetAddress address, int port)
Sets the remote address using the specified network address and port.- Parameters:
address- the remote network address.port- the remote port, from 0 through 65535.- Returns:
- this builder.
- Throws:
IllegalArgumentException- ifaddressisnull, or ifportis outside the range 0 through 65535.
-
withRemoteAddress
public T withRemoteAddress(int port)
Sets the remote address to the local loopback address using the specified port.- Parameters:
port- the remote port, from 0 through 65535.- Returns:
- this builder.
- Throws:
IllegalArgumentException- ifportis outside the range 0 through 65535.
-
withSendSyncTimeout
public T withSendSyncTimeout(long replyWaitTime)
Sets the amount of time a synchronous send waits for a reply before timing out.- Parameters:
replyWaitTime- the synchronous reply timeout in milliseconds.- Returns:
- this builder.
- Throws:
IllegalArgumentException- ifreplyWaitTimeis less than 0.
-
build
public abstract ClientParameters build()
Builds the client parameters using the current builder configuration.- Specified by:
buildin classParameters.Builder<T extends ClientParameters.Builder<T>>- Returns:
- the configured client parameters.
-
-