org.apache.mina.example.imagine.step1.client
Class ImageClient

java.lang.Object
  extended by org.apache.mina.core.service.IoHandlerAdapter
      extended by org.apache.mina.example.imagine.step1.client.ImageClient
All Implemented Interfaces:
IoHandler

public class ImageClient
extends IoHandlerAdapter

client for the ImageServer

Author:
Apache MINA Project

Field Summary
static int CONNECT_TIMEOUT
           
 
Constructor Summary
ImageClient(String host, int port, ImageListener imageListener)
           
 
Method Summary
 void connect()
           
 void disconnect()
           
 void exceptionCaught(IoSession session, Throwable cause)
          Invoked when any exception is thrown by user IoHandler implementation or by MINA.
 boolean isConnected()
           
 void messageReceived(IoSession session, Object message)
          Invoked when a message is received.
 void sendRequest(ImageRequest imageRequest)
           
 void sessionClosed(IoSession session)
          Invoked when a connection is closed.
 void sessionOpened(IoSession session)
          Invoked when a connection has been opened.
 
Methods inherited from class org.apache.mina.core.service.IoHandlerAdapter
messageSent, sessionCreated, sessionIdle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONNECT_TIMEOUT

public static final int CONNECT_TIMEOUT
See Also:
Constant Field Values
Constructor Detail

ImageClient

public ImageClient(String host,
                   int port,
                   ImageListener imageListener)
Method Detail

isConnected

public boolean isConnected()

connect

public void connect()

disconnect

public void disconnect()

sessionOpened

public void sessionOpened(IoSession session)
                   throws Exception
Description copied from interface: IoHandler
Invoked when a connection has been opened. This method is invoked after IoHandler.sessionCreated(IoSession). The biggest difference from IoHandler.sessionCreated(IoSession) is that it's invoked from other thread than an I/O processor thread once thread model is configured properly.

Specified by:
sessionOpened in interface IoHandler
Overrides:
sessionOpened in class IoHandlerAdapter
Throws:
Exception

sessionClosed

public void sessionClosed(IoSession session)
                   throws Exception
Description copied from interface: IoHandler
Invoked when a connection is closed.

Specified by:
sessionClosed in interface IoHandler
Overrides:
sessionClosed in class IoHandlerAdapter
Throws:
Exception

sendRequest

public void sendRequest(ImageRequest imageRequest)

messageReceived

public void messageReceived(IoSession session,
                            Object message)
                     throws Exception
Description copied from interface: IoHandler
Invoked when a message is received.

Specified by:
messageReceived in interface IoHandler
Overrides:
messageReceived in class IoHandlerAdapter
Throws:
Exception

exceptionCaught

public void exceptionCaught(IoSession session,
                            Throwable cause)
                     throws Exception
Description copied from interface: IoHandler
Invoked when any exception is thrown by user IoHandler implementation or by MINA. If cause is an instance of IOException, MINA will close the connection automatically.

Specified by:
exceptionCaught in interface IoHandler
Overrides:
exceptionCaught in class IoHandlerAdapter
Throws:
Exception


Copyright © 2004-2011 Apache MINA Project. All Rights Reserved.