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 TypeMethodDescriptionvoid
Invoked when aChannel
is open, bound to a local address, and connected to a remote address.void
Invoked when an exception was raised by an I/O thread or aChannelHandler
.long
void
Invoked 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:SimpleChannelUpstreamHandler
Invoked when aChannel
is 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:
channelConnected
in classSimpleChannelUpstreamHandler
-
messageReceived
Description copied from class:SimpleChannelUpstreamHandler
Invoked when a message object (e.g:ChannelBuffer
) was received from a remote peer.- Overrides:
messageReceived
in classSimpleChannelUpstreamHandler
-
exceptionCaught
Description copied from class:SimpleChannelUpstreamHandler
Invoked when an exception was raised by an I/O thread or aChannelHandler
.- Overrides:
exceptionCaught
in classSimpleChannelUpstreamHandler
-