/**
* Forwards caught exceptions to input stream.
*/
public void exceptionCaught( IoSession session, Throwable cause )
{
final IoSessionInputStream in = ( IoSessionInputStream ) session.getAttribute( KEY_IN );
IOException e = null;
if( cause instanceof StreamIoException )
{
e = ( IOException ) cause.getCause();
}
else if( cause instanceof IOException )
{
e = ( IOException ) cause;
}
if( e != null && in != null )
{
in.throwException( e );
}
else
{
SessionLog.warn( session, "Unexpected exception.", cause );
session.close();