public class Bootstrap extends AbstractBootstrap<Bootstrap,Channel>
Bootstrap
that makes it easy to bootstrap a Channel
to use
for clients.
The AbstractBootstrap.bind()
methods are useful in combination with connectionless transports such as datagram (UDP).
For regular TCP connections, please use the provided connect()
methods.
Constructor and Description |
---|
Bootstrap() |
Modifier and Type | Method and Description |
---|---|
Bootstrap |
clone()
Returns a deep clone of this bootstrap which has the identical configuration.
|
Bootstrap |
clone(EventLoopGroup group)
Returns a deep clone of this bootstrap which has the identical configuration except that it uses
the given
EventLoopGroup . |
BootstrapConfig |
config()
Returns the
AbstractBootstrapConfig object that can be used to obtain the current config
of the bootstrap. |
ChannelFuture |
connect()
Connect a
Channel to the remote peer. |
ChannelFuture |
connect(InetAddress inetHost,
int inetPort)
Connect a
Channel to the remote peer. |
ChannelFuture |
connect(SocketAddress remoteAddress)
Connect a
Channel to the remote peer. |
ChannelFuture |
connect(SocketAddress remoteAddress,
SocketAddress localAddress)
Connect a
Channel to the remote peer. |
ChannelFuture |
connect(String inetHost,
int inetPort)
Connect a
Channel to the remote peer. |
Bootstrap |
remoteAddress(InetAddress inetHost,
int inetPort) |
Bootstrap |
remoteAddress(SocketAddress remoteAddress)
The
SocketAddress to connect to once the connect() method
is called. |
Bootstrap |
remoteAddress(String inetHost,
int inetPort) |
Bootstrap |
resolver(AddressResolverGroup<?> resolver)
Sets the
NameResolver which will resolve the address of the unresolved named address. |
Bootstrap |
validate()
Validate all the parameters.
|
attr, bind, bind, bind, bind, bind, channel, channelFactory, channelFactory, group, group, handler, localAddress, localAddress, localAddress, localAddress, option, register, toString
public Bootstrap resolver(AddressResolverGroup<?> resolver)
NameResolver
which will resolve the address of the unresolved named address.resolver
- the NameResolver
for this Bootstrap
; may be null
, in which case a default
resolver will be usedDefaultAddressResolverGroup
public Bootstrap remoteAddress(SocketAddress remoteAddress)
SocketAddress
to connect to once the connect()
method
is called.public Bootstrap remoteAddress(String inetHost, int inetPort)
remoteAddress(SocketAddress)
public Bootstrap remoteAddress(InetAddress inetHost, int inetPort)
remoteAddress(SocketAddress)
public ChannelFuture connect()
Channel
to the remote peer.public ChannelFuture connect(String inetHost, int inetPort)
Channel
to the remote peer.public ChannelFuture connect(InetAddress inetHost, int inetPort)
Channel
to the remote peer.public ChannelFuture connect(SocketAddress remoteAddress)
Channel
to the remote peer.public ChannelFuture connect(SocketAddress remoteAddress, SocketAddress localAddress)
Channel
to the remote peer.public Bootstrap validate()
AbstractBootstrap
validate
in class AbstractBootstrap<Bootstrap,Channel>
public Bootstrap clone()
AbstractBootstrap
Channel
s with similar settings. Please note that this method does not clone the
EventLoopGroup
deeply but shallowly, making the group a shared resource.clone
in class AbstractBootstrap<Bootstrap,Channel>
public Bootstrap clone(EventLoopGroup group)
EventLoopGroup
. This method is useful when making multiple Channel
s with similar
settings.public final BootstrapConfig config()
AbstractBootstrap
AbstractBootstrapConfig
object that can be used to obtain the current config
of the bootstrap.config
in class AbstractBootstrap<Bootstrap,Channel>
Copyright © 2008–2017 The Netty Project. All rights reserved.