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.
构造器和说明 |
---|
Bootstrap() |
限定符和类型 | 方法和说明 |
---|---|
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(java.net.InetAddress inetHost,
int inetPort)
Connect a
Channel to the remote peer. |
ChannelFuture |
connect(java.net.SocketAddress remoteAddress)
Connect a
Channel to the remote peer. |
ChannelFuture |
connect(java.net.SocketAddress remoteAddress,
java.net.SocketAddress localAddress)
Connect a
Channel to the remote peer. |
ChannelFuture |
connect(java.lang.String inetHost,
int inetPort)
Connect a
Channel to the remote peer. |
Bootstrap |
disableResolver()
Disables address name resolution.
|
Bootstrap |
remoteAddress(java.net.InetAddress inetHost,
int inetPort) |
Bootstrap |
remoteAddress(java.net.SocketAddress remoteAddress)
The
SocketAddress to connect to once the connect() method
is called. |
Bootstrap |
remoteAddress(java.lang.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, extensionsClassLoader, 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 disableResolver()
resolver(AddressResolverGroup)
public Bootstrap remoteAddress(java.net.SocketAddress remoteAddress)
SocketAddress
to connect to once the connect()
method
is called.public Bootstrap remoteAddress(java.lang.String inetHost, int inetPort)
public Bootstrap remoteAddress(java.net.InetAddress inetHost, int inetPort)
public ChannelFuture connect()
Channel
to the remote peer.public ChannelFuture connect(java.lang.String inetHost, int inetPort)
Channel
to the remote peer.public ChannelFuture connect(java.net.InetAddress inetHost, int inetPort)
Channel
to the remote peer.public ChannelFuture connect(java.net.SocketAddress remoteAddress)
Channel
to the remote peer.public ChannelFuture connect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress)
Channel
to the remote peer.public Bootstrap validate()
AbstractBootstrap
validate
在类中 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
在类中 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
在类中 AbstractBootstrap<Bootstrap,Channel>