Package org.apache.http.nio.reactor

Examples of org.apache.http.nio.reactor.SessionOutputBuffer.writeLine()


        line.clear();
        Assert.assertTrue(inbuf.readLine(line, false));
        Assert.assertEquals("Three", line.toString());

        outbuf.writeLine(line);

        inbuf.fill(inChannel);

        line.clear();
        Assert.assertTrue(inbuf.readLine(line, true));
View Full Code Here


        line.clear();
        Assert.assertTrue(inbuf.readLine(line, true));
        Assert.assertEquals("Four", line.toString());

        outbuf.writeLine(line);

        line.clear();
        Assert.assertFalse(inbuf.readLine(line, true));

        final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
View Full Code Here

        teststrs[3] = "";
        teststrs[4] = "And goodbye";

        final SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 16, null, this.allocator);
        for (final String teststr : teststrs) {
            outbuf.writeLine(teststr);
        }
        //this write operation should have no effect
        outbuf.writeLine((String)null);
        outbuf.writeLine((CharArrayBuffer)null);
View Full Code Here

        final SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 16, null, this.allocator);
        for (final String teststr : teststrs) {
            outbuf.writeLine(teststr);
        }
        //this write operation should have no effect
        outbuf.writeLine((String)null);
        outbuf.writeLine((CharArrayBuffer)null);

        final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
        final WritableByteChannel outChannel = newChannel(outstream);
        outbuf.flush(outChannel);
View Full Code Here

        for (final String teststr : teststrs) {
            outbuf.writeLine(teststr);
        }
        //this write operation should have no effect
        outbuf.writeLine((String)null);
        outbuf.writeLine((CharArrayBuffer)null);

        final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
        final WritableByteChannel outChannel = newChannel(outstream);
        outbuf.flush(outChannel);
View Full Code Here

        final SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 16,
                Consts.UTF_8.newEncoder(), this.allocator);

        for (int i = 0; i < 10; i++) {
            outbuf.writeLine(s1);
            outbuf.writeLine(s2);
            outbuf.writeLine(s3);
        }

        final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
View Full Code Here

        final SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 16,
                Consts.UTF_8.newEncoder(), this.allocator);

        for (int i = 0; i < 10; i++) {
            outbuf.writeLine(s1);
            outbuf.writeLine(s2);
            outbuf.writeLine(s3);
        }

        final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
        final WritableByteChannel outChannel = newChannel(outstream);
View Full Code Here

                Consts.UTF_8.newEncoder(), this.allocator);

        for (int i = 0; i < 10; i++) {
            outbuf.writeLine(s1);
            outbuf.writeLine(s2);
            outbuf.writeLine(s3);
        }

        final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
        final WritableByteChannel outChannel = newChannel(outstream);
        outbuf.flush(outChannel);
View Full Code Here

    @Test
    public void testInputMatchesBufferLength() throws Exception {
        final String s1 = "abcde";
        final SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 5, null, this.allocator);
        outbuf.writeLine(s1);
    }

    @Test(expected=CharacterCodingException.class)
    public void testMalformedInputActionReport() throws Exception {
        final String s = constructString(SWISS_GERMAN_HELLO);
View Full Code Here

        final String s = "This text contains a circumflex \u0302!!!";
        final CharsetEncoder encoder = Consts.ISO_8859_1.newEncoder();
        encoder.onMalformedInput(CodingErrorAction.IGNORE);
        encoder.onUnmappableCharacter(CodingErrorAction.REPORT);
        final SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 16, encoder, this.allocator);
        outbuf.writeLine(s);
    }

    @Test
    public void testUnmappableInputActionIgnore() throws Exception {
        final String s = "This text contains a circumflex \u0302!!!";
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.