Package pygmy.nntp

Examples of pygmy.nntp.NewsHandler


        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        NntpResponse response = new NntpResponse( baos );
        forum.createNewsgroup("comp.lang.java.programmer");

        request.nextCommand();
        NewsHandler handler = new NewsHandler( forum );
        assertTrue( "Assert that the handler handled the request.", handler.handleNntp( request, response ) );
//        System.out.println( baos.toString() );
        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

TOP

Related Classes of pygmy.nntp.NewsHandler

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.