Package org.jboss.netty.example.echo
Class EchoClientHandler
java.lang.Object
org.jboss.netty.channel.SimpleChannelUpstreamHandler
org.jboss.netty.example.echo.EchoClientHandler
- All Implemented Interfaces:
ChannelHandler,ChannelUpstreamHandler
Handler implementation for the echo client. It initiates the ping-pong
traffic between the echo client and server by sending the first message to
the server.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler
ChannelHandler.Sharable -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidInvoked when aChannelis open, bound to a local address, and connected to a remote address.voidInvoked when an exception was raised by an I/O thread or aChannelHandler.longvoidInvoked when a message object (e.g:ChannelBuffer) was received from a remote peer.Methods inherited from class org.jboss.netty.channel.SimpleChannelUpstreamHandler
channelBound, channelClosed, channelDisconnected, channelInterestChanged, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, handleUpstream, writeComplete
-
Field Details
-
firstMessage
-
transferredBytes
-
-
Constructor Details
-
EchoClientHandler
public EchoClientHandler()Creates a client-side handler.
-
-
Method Details
-
getTransferredBytes
public long getTransferredBytes() -
channelConnected
Description copied from class:SimpleChannelUpstreamHandlerInvoked when aChannelis open, bound to a local address, and connected to a remote address.
Be aware that this event is fired from within the I/O thread. You should never execute any heavy operation in there as it will block the dispatching to other workers!- Overrides:
channelConnectedin classSimpleChannelUpstreamHandler
-
messageReceived
Description copied from class:SimpleChannelUpstreamHandlerInvoked when a message object (e.g:ChannelBuffer) was received from a remote peer.- Overrides:
messageReceivedin classSimpleChannelUpstreamHandler
-
exceptionCaught
Description copied from class:SimpleChannelUpstreamHandlerInvoked when an exception was raised by an I/O thread or aChannelHandler.- Overrides:
exceptionCaughtin classSimpleChannelUpstreamHandler
-