Top Description Constructors Methods
io.netty.channel

public Class ChannelDuplexHandler

extends ChannelInboundHandlerAdapter
implements ChannelOutboundHandler
Class Inheritance
All Implemented Interfaces
io.netty.channel.ChannelOutboundHandler, io.netty.channel.ChannelHandler
Known Direct Subclasses
io.netty.channel.CombinedChannelDuplexHandler
Imports
io.netty.channel.ChannelHandlerMask.Skip, java.net.SocketAddress

ChannelHandler implementation which represents a combination out of a ChannelInboundHandler and the ChannelOutboundHandler. It is a good starting point if your ChannelHandler implementation needs to intercept operations and also state updates.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
bind(ChannelHandlerContext
the ChannelHandlerContext for which the bind operation is made
ctx
,
SocketAddress
the SocketAddress to which it should bound
localAddress
,
ChannelPromise
the ChannelPromise to notify once the operation completes
promise
)

Implements io.netty.channel.ChannelOutboundHandler.bind.

Calls ChannelHandlerContext#bind(SocketAddress, ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline.
public void
close(ChannelHandlerContext
the ChannelHandlerContext for which the close operation is made
ctx
,
ChannelPromise
the ChannelPromise to notify once the operation completes
promise
)

Implements io.netty.channel.ChannelOutboundHandler.close.

Calls ChannelHandlerContext#close(ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline.
public void
connect(ChannelHandlerContext
the ChannelHandlerContext for which the connect operation is made
ctx
,
SocketAddress
the SocketAddress to which it should connect
remoteAddress
,
SocketAddress
the SocketAddress which is used as source on connect
localAddress
,
ChannelPromise
the ChannelPromise to notify once the operation completes
promise
)

Implements io.netty.channel.ChannelOutboundHandler.connect.

Calls ChannelHandlerContext#connect(SocketAddress, SocketAddress, ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline.
public void
deregister(ChannelHandlerContext
the ChannelHandlerContext for which the close operation is made
ctx
,
ChannelPromise
the ChannelPromise to notify once the operation completes
promise
)

Implements io.netty.channel.ChannelOutboundHandler.deregister.

Calls ChannelHandlerContext#deregister(ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline.
public void
disconnect(ChannelHandlerContext
the ChannelHandlerContext for which the disconnect operation is made
ctx
,
ChannelPromise
the ChannelPromise to notify once the operation completes
promise
)

Implements io.netty.channel.ChannelOutboundHandler.disconnect.

Calls ChannelHandlerContext#disconnect(ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline.
public void
public void
public void
write(ChannelHandlerContext
the ChannelHandlerContext for which the write operation is made
ctx
,
Object
the message to write
msg
,
ChannelPromise
the ChannelPromise to notify once the operation completes
promise
)

Implements io.netty.channel.ChannelOutboundHandler.write.

Calls ChannelHandlerContext#write(Object, ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline.
Inherited from io.netty.channel.ChannelInboundHandlerAdapter:
channelActivechannelInactivechannelReadchannelReadCompletechannelRegisteredchannelUnregisteredchannelWritabilityChangedexceptionCaughtuserEventTriggered

Constructor Detail

ChannelDuplexHandlerback to summary
public ChannelDuplexHandler()

Method Detail

bindback to summary
public void bind(ChannelHandlerContext ctx, SocketAddress localAddress, ChannelPromise promise) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.bind.

Calls ChannelHandlerContext#bind(SocketAddress, ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.

Parameters
ctx:ChannelHandlerContext

Doc from io.netty.channel.ChannelOutboundHandler.bind.

the ChannelHandlerContext for which the bind operation is made

localAddress:SocketAddress

Doc from io.netty.channel.ChannelOutboundHandler.bind.

the SocketAddress to which it should bound

promise:ChannelPromise

Doc from io.netty.channel.ChannelOutboundHandler.bind.

the ChannelPromise to notify once the operation completes

Annotations
@Skip
@Override
Exceptions
Exception:

Doc from io.netty.channel.ChannelOutboundHandler.bind.

thrown if an error occurs

closeback to summary
public void close(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.close.

Calls ChannelHandlerContext#close(ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.

Parameters
ctx:ChannelHandlerContext

Doc from io.netty.channel.ChannelOutboundHandler.close.

the ChannelHandlerContext for which the close operation is made

promise:ChannelPromise

Doc from io.netty.channel.ChannelOutboundHandler.close.

the ChannelPromise to notify once the operation completes

Annotations
@Skip
@Override
Exceptions
Exception:

Doc from io.netty.channel.ChannelOutboundHandler.close.

thrown if an error occurs

connectback to summary
public void connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.connect.

Calls ChannelHandlerContext#connect(SocketAddress, SocketAddress, ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.

Parameters
ctx:ChannelHandlerContext

Doc from io.netty.channel.ChannelOutboundHandler.connect.

the ChannelHandlerContext for which the connect operation is made

remoteAddress:SocketAddress

Doc from io.netty.channel.ChannelOutboundHandler.connect.

the SocketAddress to which it should connect

localAddress:SocketAddress

Doc from io.netty.channel.ChannelOutboundHandler.connect.

the SocketAddress which is used as source on connect

promise:ChannelPromise

Doc from io.netty.channel.ChannelOutboundHandler.connect.

the ChannelPromise to notify once the operation completes

Annotations
@Skip
@Override
Exceptions
Exception:

Doc from io.netty.channel.ChannelOutboundHandler.connect.

thrown if an error occurs

deregisterback to summary
public void deregister(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.deregister.

Calls ChannelHandlerContext#deregister(ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.

Parameters
ctx:ChannelHandlerContext

Doc from io.netty.channel.ChannelOutboundHandler.deregister.

the ChannelHandlerContext for which the close operation is made

promise:ChannelPromise

Doc from io.netty.channel.ChannelOutboundHandler.deregister.

the ChannelPromise to notify once the operation completes

Annotations
@Skip
@Override
Exceptions
Exception:

Doc from io.netty.channel.ChannelOutboundHandler.deregister.

thrown if an error occurs

disconnectback to summary
public void disconnect(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.disconnect.

Calls ChannelHandlerContext#disconnect(ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.

Parameters
ctx:ChannelHandlerContext

Doc from io.netty.channel.ChannelOutboundHandler.disconnect.

the ChannelHandlerContext for which the disconnect operation is made

promise:ChannelPromise

Doc from io.netty.channel.ChannelOutboundHandler.disconnect.

the ChannelPromise to notify once the operation completes

Annotations
@Skip
@Override
Exceptions
Exception:

Doc from io.netty.channel.ChannelOutboundHandler.disconnect.

thrown if an error occurs

flushback to summary
public void flush(ChannelHandlerContext ctx) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.flush.

Calls ChannelHandlerContext#flush() to forward to the next ChannelOutboundHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.

Parameters
ctx:ChannelHandlerContext

Doc from io.netty.channel.ChannelOutboundHandler.flush.

the ChannelHandlerContext for which the flush operation is made

Annotations
@Skip
@Override
Exceptions
Exception:

Doc from io.netty.channel.ChannelOutboundHandler.flush.

thrown if an error occurs

readback to summary
public void read(ChannelHandlerContext ctx) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.read.

Calls ChannelHandlerContext#read() to forward to the next ChannelOutboundHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.

Annotations
@Skip
@Override
writeback to summary
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.write.

Calls ChannelHandlerContext#write(Object, ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.

Parameters
ctx:ChannelHandlerContext

Doc from io.netty.channel.ChannelOutboundHandler.write.

the ChannelHandlerContext for which the write operation is made

msg:Object

Doc from io.netty.channel.ChannelOutboundHandler.write.

the message to write

promise:ChannelPromise

Doc from io.netty.channel.ChannelOutboundHandler.write.

the ChannelPromise to notify once the operation completes

Annotations
@Skip
@Override
Exceptions
Exception:

Doc from io.netty.channel.ChannelOutboundHandler.write.

thrown if an error occurs