Package org.apache.mina.common

Examples of org.apache.mina.common.ByteBuffer.clear()


        Assert.assertEquals( 2, out.getMessageQueue().size() );
        Assert.assertEquals( "JKL", out.getMessageQueue().pop() );
        Assert.assertEquals( "MNO", out.getMessageQueue().pop() );
       
        // Test multiple '\n's
        in.clear();
        in.putString( "\n\n\n", encoder );
        in.flip();
        decoder.decode( session, in, out );
        Assert.assertEquals( 3, out.getMessageQueue().size() );
        Assert.assertEquals( "", out.getMessageQueue().pop() );
View Full Code Here


        Assert.assertEquals( "", out.getMessageQueue().pop() );
        Assert.assertEquals( "", out.getMessageQueue().pop() );
        Assert.assertEquals( "", out.getMessageQueue().pop() );
       
        // Test splitted long delimiter (\r\r\n)
        in.clear();
        in.putString( "PQR\r", encoder );
        in.flip();
        decoder.decode( session, in, out );
        Assert.assertEquals( 0, out.getMessageQueue().size() );
        in.clear();
View Full Code Here

        in.clear();
        in.putString( "PQR\r", encoder );
        in.flip();
        decoder.decode( session, in, out );
        Assert.assertEquals( 0, out.getMessageQueue().size() );
        in.clear();
        in.putString( "\r", encoder );
        in.flip();
        decoder.decode( session, in, out );
        Assert.assertEquals( 0, out.getMessageQueue().size() );
        in.clear();
View Full Code Here

        in.clear();
        in.putString( "\r", encoder );
        in.flip();
        decoder.decode( session, in, out );
        Assert.assertEquals( 0, out.getMessageQueue().size() );
        in.clear();
        in.putString( "\n", encoder );
        in.flip();
        decoder.decode( session, in, out );
        Assert.assertEquals( 1, out.getMessageQueue().size() );
        Assert.assertEquals( "PQR", out.getMessageQueue().pop() );
View Full Code Here

        try
        {
            int readBytes = 0;
            int ret;

            buf.clear();

            try
            {
                while( ( ret = ch.read( buf.buf() ) ) > 0 )
                {
View Full Code Here

    private void testConnector0( IoSession session ) throws InterruptedException
    {
        EchoConnectorHandler handler = ( EchoConnectorHandler ) session.getHandler();
        ByteBuffer readBuf = handler.readBuf;
        readBuf.clear();
        WriteFuture writeFuture = null;
        for( int i = 0; i < COUNT; i ++ )
        {
            ByteBuffer buf = ByteBuffer.allocate( DATA_SIZE );
            buf.limit( DATA_SIZE );
View Full Code Here

        try
        {
            int readBytes = 0;
            int ret;

            buf.clear();

            try
            {
                while( ( ret = ch.read( buf.buf() ) ) > 0 )
                {
View Full Code Here

        decoder.decode(session, in, out);
        Assert.assertEquals(1, out.getMessageQueue().size());
        Assert.assertEquals("ABC", out.getMessageQueue().pop());

        // Test two decode and one output
        in.clear();
        in.putString("DEF", encoder);
        in.flip();
        decoder.decode(session, in, out);
        Assert.assertEquals(0, out.getMessageQueue().size());
        in.clear();
View Full Code Here

        in.clear();
        in.putString("DEF", encoder);
        in.flip();
        decoder.decode(session, in, out);
        Assert.assertEquals(0, out.getMessageQueue().size());
        in.clear();
        in.putString("GHI\r\n", encoder);
        in.flip();
        decoder.decode(session, in, out);
        Assert.assertEquals(1, out.getMessageQueue().size());
        Assert.assertEquals("DEFGHI", out.getMessageQueue().pop());
View Full Code Here

        decoder.decode(session, in, out);
        Assert.assertEquals(1, out.getMessageQueue().size());
        Assert.assertEquals("DEFGHI", out.getMessageQueue().pop());

        // Test one decode and two output
        in.clear();
        in.putString("JKL\r\nMNO\r\n", encoder);
        in.flip();
        decoder.decode(session, in, out);
        Assert.assertEquals(2, out.getMessageQueue().size());
        Assert.assertEquals("JKL", out.getMessageQueue().pop());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.