public class ClientOptions extends NettyOptions<Bootstrap,ClientOptions>
| Modifier and Type | Class and Description |
|---|---|
static class |
ClientOptions.Proxy
Proxy Type
|
DEFAULT_PORT| Modifier | Constructor and Description |
|---|---|
protected |
ClientOptions()
Build a new
ClientOptions out of a new Bootstrap |
protected |
ClientOptions(Bootstrap bootstrap)
Apply common option via super constructor then apply
defaultClientOptions(Bootstrap)
to the passed bootstrap. |
protected |
ClientOptions(ClientOptions options)
Deep-copy all references from the passed options into this new
NettyOptions instance. |
| Modifier and Type | Method and Description |
|---|---|
ClientOptions |
connect(InetSocketAddress connectAddress)
The address to which this client should connect.
|
ClientOptions |
connect(int port)
The localhost port to which this client should connect.
|
ClientOptions |
connect(String host,
int port)
The host and port to which this client should connect.
|
ClientOptions |
connect(java.util.function.Supplier<? extends InetSocketAddress> connectAddress)
The address to which this client should connect.
|
static ClientOptions |
create()
Create a client builder.
|
ClientOptions |
disablePool()
Disable current
poolResources |
ClientOptions |
duplicate()
Return a copy of all options and references such as
NettyOptions.onChannelInit(Predicate). |
Bootstrap |
get() |
SocketAddress |
getAddress()
Return a new eventual
SocketAddress |
PoolResources |
getPoolResources()
Get the configured Pool Resources if any
|
ProxyHandler |
getProxyHandler()
Return a new eventual
ProxyHandler |
boolean |
isPoolAvailable() |
boolean |
isPoolDisabled() |
ClientOptions |
poolResources(PoolResources poolResources)
Configures the
ChannelPool selector for the socket. |
ClientOptions |
protocolFamily(InternetProtocolFamily protocolFamily)
Configures the version family for the socket.
|
ClientOptions |
proxy(ClientOptions.Proxy type,
InetSocketAddress connectAddress)
Let this client connect through a proxy by providing an address.
|
ClientOptions |
proxy(ClientOptions.Proxy type,
InetSocketAddress connectAddress,
String username,
java.util.function.Function<? super String,? extends String> password)
Let this client connect through a proxy by providing an address and credentials.
|
ClientOptions |
proxy(ClientOptions.Proxy type,
String host,
int port)
Let this client connect through a proxy by providing a host and port.
|
ClientOptions |
proxy(ClientOptions.Proxy type,
String host,
int port,
String username,
java.util.function.Function<? super String,? extends String> password)
Let this client connect through a proxy by providing a host, port and credentials.
|
ClientOptions |
proxy(ClientOptions.Proxy type,
java.util.function.Supplier<? extends InetSocketAddress> connectAddress)
Let this client connect through a proxy by providing an address supplier.
|
ClientOptions |
proxy(ClientOptions.Proxy type,
java.util.function.Supplier<? extends InetSocketAddress> connectAddress,
String username,
java.util.function.Function<? super String,? extends String> password)
Let this client connect through a proxy by providing an address supplier.
|
ClientOptions |
resolver(AddressResolverGroup<?> resolver)
Assign an
AddressResolverGroup. |
ClientOptions |
sslSupport()
Enable default sslContext support
|
ClientOptions |
sslSupport(java.util.function.Consumer<? super SslContextBuilder> configurator)
Enable default sslContext support and enable further customization via the passed
configurator.
|
protected boolean |
useDatagramChannel()
Return true if
DatagramChannel should be used |
protected boolean |
useProxy()
Return true if proxy options have been set
|
afterChannelInit, afterChannelInit, attr, channelGroup, defaultSslContext, eventLoopGroup, getLoopResources, getSslHandler, isLoopAvailable, loopResources, onChannelInit, onChannelInit, option, preferNative, preferNative, sslCloseNotifyFlushTimeout, sslCloseNotifyFlushTimeoutMillis, sslCloseNotifyReadTimeout, sslCloseNotifyReadTimeoutMillis, sslContext, sslHandshakeTimeout, sslHandshakeTimeoutMillis, toStringprotected ClientOptions()
ClientOptions out of a new Bootstrapprotected ClientOptions(Bootstrap bootstrap)
defaultClientOptions(Bootstrap)
to the passed bootstrap.bootstrap - the bootstrap reference to useprotected ClientOptions(ClientOptions options)
NettyOptions instance.options - the source options to duplicatepublic static ClientOptions create()
public ClientOptions connect(int port)
port - The port to connect to.public ClientOptions connect(@Nonnull String host, int port)
host - The host to connect to.port - The port to connect to.public ClientOptions connect(@Nonnull InetSocketAddress connectAddress)
connectAddress - The address to connect to.public ClientOptions connect(@Nonnull java.util.function.Supplier<? extends InetSocketAddress> connectAddress)
connectAddress - A supplier of the address to connect to.public ClientOptions disablePool()
poolResourcesthispublic final boolean isPoolDisabled()
public final boolean isPoolAvailable()
public ClientOptions duplicate()
NettyOptionsNettyOptions.onChannelInit(Predicate). Further option uses on the returned builder will
be fully isolated from this option builder.duplicate in class NettyOptions<Bootstrap,ClientOptions>public Bootstrap get()
get in interface java.util.function.Supplier<Bootstrap>get in class NettyOptions<Bootstrap,ClientOptions>public final SocketAddress getAddress()
NettyOptionsSocketAddressgetAddress in class NettyOptions<Bootstrap,ClientOptions>SocketAddress or nullpublic final PoolResources getPoolResources()
PoolResourcespublic final ProxyHandler getProxyHandler()
ProxyHandlerProxyHandlerpublic ClientOptions poolResources(PoolResources poolResources)
ChannelPool selector for the socket. Will effectively
enable client connection-pooling.poolResources - the PoolResources given
an InetSocketAddressthispublic ClientOptions protocolFamily(InternetProtocolFamily protocolFamily)
protocolFamily - the version family for the socket, or null for the system
default familythispublic ClientOptions proxy(@Nonnull ClientOptions.Proxy type, @Nonnull String host, int port, @Nullable String username, @Nullable java.util.function.Function<? super String,? extends String> password)
type - The proxy type.host - The proxy host to connect to.port - The proxy port to connect to.username - The proxy username.password - A function to supply the proxy's password from the username.public ClientOptions proxy(@Nonnull ClientOptions.Proxy type, @Nonnull String host, int port)
type - The proxy type.host - The host to connect to.port - The port to connect to.public ClientOptions proxy(@Nonnull ClientOptions.Proxy type, @Nonnull InetSocketAddress connectAddress)
type - The proxy type.connectAddress - The address to connect to.public ClientOptions proxy(@Nonnull ClientOptions.Proxy type, @Nonnull InetSocketAddress connectAddress, @Nullable String username, @Nullable java.util.function.Function<? super String,? extends String> password)
type - The proxy type.connectAddress - The address to connect to.username - The proxy username.password - A function to supply the proxy's password from the username.public ClientOptions proxy(@Nonnull ClientOptions.Proxy type, @Nonnull java.util.function.Supplier<? extends InetSocketAddress> connectAddress)
type - The proxy type.connectAddress - The supplier for the address to connect to.public ClientOptions proxy(@Nonnull ClientOptions.Proxy type, @Nonnull java.util.function.Supplier<? extends InetSocketAddress> connectAddress, @Nullable String username, @Nullable java.util.function.Function<? super String,? extends String> password)
type - The proxy type.connectAddress - The supplier for the address to connect to.username - The proxy username.password - A function to supply the proxy's password from the username.public ClientOptions resolver(AddressResolverGroup<?> resolver)
AddressResolverGroup.resolver - the new AddressResolverGroupClientOptionspublic ClientOptions sslSupport()
ClientOptionspublic ClientOptions sslSupport(java.util.function.Consumer<? super SslContextBuilder> configurator)
SslContext to be passed to
NettyOptions.sslContext(SslContext).configurator - builder callback for further customization.ClientOptionsprotected boolean useDatagramChannel()
DatagramChannel should be usedDatagramChannel should be usedprotected boolean useProxy()