Package java.io

Examples of java.io.ByteArrayOutputStream.reset()


                }

            // #%
            } else if ((bb & 0xFF) == pcChar) { //include
                final ByteBuffer include = new ByteBuffer();
                keyStream.reset(); //reset stream
                if(transferUntil(pis, keyStream, iClose)){
                    byte[] filename = keyStream.toByteArray();
                    //if(filename.startsWith( Character.toString((char)lbr) ) && filename.endsWith( Character.toString((char)rbr) )){ //simple pattern for filename
                    if((filename[0] == lbr) && (filename[filename.length-1] == rbr)){ //simple pattern for filename
                        final byte[] newFilename = new byte[filename.length-2];
View Full Code Here


        assertTrue( "Assert the response asked to send the article", baos.toString().startsWith("335 send article to be transferred.  End with <CR-LF>.<CR-LF>") );
        assertEquals( "Assert the forum size has increased by one.", 1, forum.getNewsgroup( "comp.lang.java.programmer" ).size() );
        assertTrue( "Assert the response received the article.", baos.toString().indexOf( "235 article transferred ok" ) >= 0 );

        request.nextCommand();
        baos.reset();
        assertTrue( "Assert that the handler handled the request.", handler.handleNntp( request, response ) );
        assertTrue( "Assert the response denied the article", baos.toString().startsWith("435 article not wanted - do not send i") );

        forum.addArticle( NntpTestUtil.createArticle("test.eml"), "localhost" );
    }
View Full Code Here

        forum.createNewsgroup("rec.music.makers").addArticle( NntpTestUtil.createArticle("test.eml"), "localhost" );
        request.nextCommand();
        assertTrue( "Assert that the handler handled the request.", handler.handleNntp( request, response ) );
        assertTrue( baos.toString().indexOf("215 list of newsgroups follows") >= 0 );

        baos.reset();
        request.nextCommand();
        assertTrue( "Assert that the handler handled the request.", handler.handleNntp( request, response ) );
        assertTrue( baos.toString().indexOf("211 0 2147483647 0 comp.lang.java") >= 0 );

        baos.reset();
View Full Code Here

        baos.reset();
        request.nextCommand();
        assertTrue( "Assert that the handler handled the request.", handler.handleNntp( request, response ) );
        assertTrue( baos.toString().indexOf("211 0 2147483647 0 comp.lang.java") >= 0 );

        baos.reset();
        request.nextCommand();
        assertTrue( "Assert that the handler handled the request.", handler.handleNntp( request, response ) );
        assertTrue( baos.toString().indexOf("411 no such news group") >= 0 );
    }
View Full Code Here

        assertTrue( baos.toString().indexOf("235 article transferred ok") >= 0 );
        programmer = forum.getNewsgroup("comp.lang.java.programmer");
        assertEquals( 1, programmer.size() );

        request.setCurrentNewsgroup("comp.lang.java.programmer");
        baos.reset();
        request.nextCommand();
        assertTrue( "Assert that the handler handled the request.", handler.handleNntp( request, response ) );
        assertTrue( baos.toString().indexOf("220") >= 0 );

    }
View Full Code Here

        forum.createNewsgroup("comp.lang.ada").addArticle( NntpTestUtil.createArticle("test.eml"), "localhost" );
        forum.createNewsgroup("rec.music.makers").addArticle( NntpTestUtil.createArticle("test.eml"), "localhost" );
        forum.getNewsgroup("rec.music.makers").addArticle( NntpTestUtil.createArticle("test.eml"), "localhost" );
        forum.addArticle( NntpTestUtil.createArticle("test.eml"), "localhost" );

        baos.reset();
        request.nextCommand();
        ArticleHandler handler = new ArticleHandler( forum );
        assertTrue( "Assert that the handler handled the request.", handler.handleNntp( request, response ) );
//        System.out.println(baos.toString());
        assertTrue( baos.toString().indexOf("420 no current article has been selected") >= 0 );
View Full Code Here

//        System.out.println(baos.toString());
        assertTrue( baos.toString().indexOf("412 no newsgroup has been selected") >= 0 );

        request.setCurrentNewsgroup("comp.lang.ada");
        request.setCurrentArticle("1");
        baos.reset();
        request.nextCommand();
        assertTrue( "Assert that the handler handled the request.", handler.handleNntp( request, response ) );
//        System.out.println(baos.toString());
        assertTrue( baos.toString().indexOf("421 no next article in this group") >= 0 );
View Full Code Here

        request.nextCommand();
        assertTrue( "Assert that the handler handled the request.", handler.handleNntp( request, response ) );
//        System.out.println(baos.toString());
        assertTrue( baos.toString().indexOf("421 no next article in this group") >= 0 );

        baos.reset();
        request.nextCommand();
        assertTrue( "Assert that the handler handled the request.", handler.handleNntp( request, response ) );
//        System.out.println(baos.toString());
        assertTrue( baos.toString().indexOf("422 no previous article in this group") >= 0 );
View Full Code Here

        assertTrue( "Assert that the handler handled the request.", handler.handleNntp( request, response ) );
//        System.out.println(baos.toString());
        assertTrue( baos.toString().indexOf("422 no previous article in this group") >= 0 );

        request.setCurrentNewsgroup("rec.music.makers");
        baos.reset();
        request.nextCommand();
        assertTrue( "Assert that the handler handled the request.", handler.handleNntp( request, response ) );
//        System.out.println(baos.toString());
        assertTrue( baos.toString().indexOf("220 1 <blkdu9$pd8$1@hood.uits.indiana.edu> article retrieved - head and body follow") >= 0 );
View Full Code Here

        request.nextCommand();
        assertTrue( "Assert that the handler handled the request.", handler.handleNntp( request, response ) );
//        System.out.println(baos.toString());
        assertTrue( baos.toString().indexOf("220 1 <blkdu9$pd8$1@hood.uits.indiana.edu> article retrieved - head and body follow") >= 0 );

        baos.reset();
        request.nextCommand();
        assertTrue( "Assert that the handler handled the request.", handler.handleNntp( request, response ) );
//        System.out.println(baos.toString());
        assertTrue( baos.toString().indexOf("223 2 <blkdu9$pd8$1@hood.uits.indiana.edu> article retrieved - request text separately") >= 0 );
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.