Package io.netty.bootstrap
Class Bootstrap
- java.lang.Object
-
- io.netty.bootstrap.AbstractBootstrap<Bootstrap,Channel>
-
- io.netty.bootstrap.Bootstrap
-
- All Implemented Interfaces:
java.lang.Cloneable
public class Bootstrap extends AbstractBootstrap<Bootstrap,Channel>
ABootstrapthat makes it easy to bootstrap aChannelto 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 providedconnect()methods.
-
-
Constructor Summary
Constructors Constructor Description Bootstrap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Bootstrapclone()Returns a deep clone of this bootstrap which has the identical configuration.Bootstrapclone(EventLoopGroup group)Returns a deep clone of this bootstrap which has the identical configuration except that it uses the givenEventLoopGroup.BootstrapConfigconfig()Returns theAbstractBootstrapConfigobject that can be used to obtain the current config of the bootstrap.ChannelFutureconnect()Connect aChannelto the remote peer.ChannelFutureconnect(java.lang.String inetHost, int inetPort)Connect aChannelto the remote peer.ChannelFutureconnect(java.net.InetAddress inetHost, int inetPort)Connect aChannelto the remote peer.ChannelFutureconnect(java.net.SocketAddress remoteAddress)Connect aChannelto the remote peer.ChannelFutureconnect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress)Connect aChannelto the remote peer.BootstrapdisableResolver()Disables address name resolution.BootstrapremoteAddress(java.lang.String inetHost, int inetPort)BootstrapremoteAddress(java.net.InetAddress inetHost, int inetPort)BootstrapremoteAddress(java.net.SocketAddress remoteAddress)TheSocketAddressto connect to once theconnect()method is called.Bootstrapresolver(AddressResolverGroup<?> resolver)Sets theNameResolverwhich will resolve the address of the unresolved named address.Bootstrapvalidate()Validate all the parameters.-
Methods inherited from class io.netty.bootstrap.AbstractBootstrap
attr, bind, bind, bind, bind, bind, channel, channelFactory, channelFactory, extensionsClassLoader, group, group, handler, localAddress, localAddress, localAddress, localAddress, option, register, toString
-
-
-
-
Method Detail
-
resolver
public Bootstrap resolver(AddressResolverGroup<?> resolver)
Sets theNameResolverwhich will resolve the address of the unresolved named address.- Parameters:
resolver- theNameResolverfor thisBootstrap; may benull, in which case a default resolver will be used- See Also:
DefaultAddressResolverGroup
-
disableResolver
public Bootstrap disableResolver()
Disables address name resolution. Name resolution may be re-enabled withresolver(AddressResolverGroup)
-
remoteAddress
public Bootstrap remoteAddress(java.net.SocketAddress remoteAddress)
TheSocketAddressto connect to once theconnect()method is called.
-
remoteAddress
public Bootstrap remoteAddress(java.lang.String inetHost, int inetPort)
- See Also:
remoteAddress(SocketAddress)
-
remoteAddress
public Bootstrap remoteAddress(java.net.InetAddress inetHost, int inetPort)
- See Also:
remoteAddress(SocketAddress)
-
connect
public ChannelFuture connect()
Connect aChannelto the remote peer.
-
connect
public ChannelFuture connect(java.lang.String inetHost, int inetPort)
Connect aChannelto the remote peer.
-
connect
public ChannelFuture connect(java.net.InetAddress inetHost, int inetPort)
Connect aChannelto the remote peer.
-
connect
public ChannelFuture connect(java.net.SocketAddress remoteAddress)
Connect aChannelto the remote peer.
-
connect
public ChannelFuture connect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress)
Connect aChannelto the remote peer.
-
validate
public Bootstrap validate()
Description copied from class:AbstractBootstrapValidate all the parameters. Sub-classes may override this, but should call the super method in that case.- Overrides:
validatein classAbstractBootstrap<Bootstrap,Channel>
-
clone
public Bootstrap clone()
Description copied from class:AbstractBootstrapReturns a deep clone of this bootstrap which has the identical configuration. This method is useful when making multipleChannels with similar settings. Please note that this method does not clone theEventLoopGroupdeeply but shallowly, making the group a shared resource.- Specified by:
clonein classAbstractBootstrap<Bootstrap,Channel>
-
clone
public Bootstrap clone(EventLoopGroup group)
Returns a deep clone of this bootstrap which has the identical configuration except that it uses the givenEventLoopGroup. This method is useful when making multipleChannels with similar settings.
-
config
public final BootstrapConfig config()
Description copied from class:AbstractBootstrapReturns theAbstractBootstrapConfigobject that can be used to obtain the current config of the bootstrap.- Specified by:
configin classAbstractBootstrap<Bootstrap,Channel>
-
-