Package org.apache.mina.protocol

Examples of org.apache.mina.protocol.ProtocolViolationException


            // Don't accept too long line
            if( decodeBuf.length() > 256 )
            {
                decodeBuf.delete( 0, decodeBuf.length() );
                throw new ProtocolViolationException( "The line is too long." );
            }
        }
        while( in.hasRemaining() );
    }
View Full Code Here


        String val = message.toString();
        // Don't accept too long strings.
        if( val.length() > 256 )
        {
            throw new ProtocolViolationException(
                                                  "Cannot encode too long string." );
        }

        val += "\r\n";
View Full Code Here

        {
            Class type = message.getClass();
            MessageEncoder encoder = findEncoder( type );
            if( encoder == null )
            {
                throw new ProtocolViolationException( "Unexpected message type: " + type );
            }
           
            encoder.encode( session, message, out );
        }
View Full Code Here

               
                if( undecodables == decoders.length )
                {
                    // Throw an exception if all decoders cannot decode data.
                    in.position( in.limit() ); // Skip data
                    throw new ProtocolViolationException(
                            "No appropriate message decoder: " + in.getHexDump() );
                }
               
                if( currentDecoder == null )
                {
                    // Decoder is not determined yet (i.e. we need more data)
                    return false;
                }
            }
           
            MessageDecoderResult result = currentDecoder.decode( session, in, out );
            if( result == MessageDecoder.OK )
            {
                currentDecoder = null;
                return true;
            }
            else if( result == MessageDecoder.NEED_DATA )
            {
                return false;
            }
            else if( result == MessageDecoder.NOT_OK )
            {
                throw new ProtocolViolationException( "Message decoder returned NOT_OK." );
            }
            else
            {
                throw new IllegalStateException( "Unexpected decode result (see your decode()): " + result );
            }
View Full Code Here

            // Don't accept too long line
            if( decodeBuf.length() > 256 )
            {
                decodeBuf.delete( 0, decodeBuf.length() );
                throw new ProtocolViolationException( "The line is too long." );
            }
        }
        while( in.hasRemaining() );
    }
View Full Code Here

        String val = message.toString();
        // Don't accept too long strings.
        if( val.length() > 256 )
        {
            throw new ProtocolViolationException(
                                                  "Cannot encode too long string." );
        }

        val += "\r\n";
View Full Code Here

        {
            Class type = message.getClass();
            MessageEncoder encoder = findEncoder( type );
            if( encoder == null )
            {
                throw new ProtocolViolationException( "Unexpected message type: " + type );
            }
           
            encoder.encode( session, message, out );
        }
View Full Code Here

               
                if( undecodables == decoders.length )
                {
                    // Throw an exception if all decoders cannot decode data.
                    in.position( in.limit() ); // Skip data
                    throw new ProtocolViolationException(
                            "No appropriate message decoder: " + in.getHexDump() );
                }
               
                if( currentDecoder == null )
                {
                    // Decoder is not determined yet (i.e. we need more data)
                    return false;
                }
            }
           
            MessageDecoderResult result = currentDecoder.decode( session, in, out );
            if( result == MessageDecoder.OK )
            {
                currentDecoder = null;
                return true;
            }
            else if( result == MessageDecoder.NEED_DATA )
            {
                return false;
            }
            else if( result == MessageDecoder.NOT_OK )
            {
                throw new ProtocolViolationException( "Message decoder returned NOT_OK." );
            }
            else
            {
                throw new IllegalStateException( "Unexpected decode result (see your decode()): " + result );
            }
View Full Code Here

        {
            Class type = message.getClass();
            MessageEncoder encoder = findEncoder( type );
            if( encoder == null )
            {
                throw new ProtocolViolationException( "Unexpected message type: " + type );
            }
           
            encoder.encode( session, message, out );
        }
View Full Code Here

               
                if( undecodables == decoders.length )
                {
                    // Throw an exception if all decoders cannot decode data.
                    in.position( in.limit() ); // Skip data
                    throw new ProtocolViolationException(
                            "No appropriate message decoder: " + in.getHexDump() );
                }
               
                if( currentDecoder == null )
                {
                    // Decoder is not determined yet (i.e. we need more data)
                    return false;
                }
            }
           
            MessageDecoderResult result = currentDecoder.decode( session, in, out );
            if( result == MessageDecoder.OK )
            {
                currentDecoder = null;
                return true;
            }
            else if( result == MessageDecoder.NEED_DATA )
            {
                return false;
            }
            else if( result == MessageDecoder.NOT_OK )
            {
                throw new ProtocolViolationException( "Message decoder returned NOT_OK." );
            }
            else
            {
                throw new IllegalStateException( "Unexpected decode result (see your decode()): " + result );
            }
View Full Code Here

TOP

Related Classes of org.apache.mina.protocol.ProtocolViolationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.