Examples of StringEndPoint


Examples of org.mortbay.io.bio.StringEndPoint

    }

    public void testMultiParse()
    throws Exception
    {
        StringEndPoint io=new StringEndPoint();
        io.setInput(
            "GET /mp HTTP/1.0\015\012"
                + "Header1: value1\015\012"
        + "Transfer-Encoding: chunked\015\012"
                + "\015\012"
                + "a;\015\012"
View Full Code Here

Examples of org.mortbay.io.bio.StringEndPoint

        assertEquals("0123456789", _content);
    }

    public void testStreamParse() throws Exception
    {
        StringEndPoint io=new StringEndPoint();
        String http="GET / HTTP/1.0\015\012"
                + "Header1: value1\015\012"
        + "Transfer-Encoding: chunked\015\012"
                + "\015\012"
                + "a;\015\012"
                + "0123456789\015\012"
                + "1a\015\012"
                + "ABCDEFGHIJKLMNOPQRSTUVWXYZ\015\012"
                + "0\015\012"
                + "POST /foo HTTP/1.0\015\012"
                + "Header2: value2\015\012"
                + "Content-Length: 0\015\012"
                + "\015\012"
                + "PUT /doodle HTTP/1.0\015\012"
                + "Header3: value3\015\012"
        + "Content-Length: 10\015\012"
                + "\015\012"
                + "0123456789\015\012";

       
        int[] tests=
            {
                1024,
                http.length() + 3,
                http.length() + 2,
                http.length() + 1,
                http.length() + 0,
                http.length() - 1,
                http.length() - 2,
                http.length() / 2,
                http.length() / 3,
                64,
                32
            };
       
        for (int t= 0; t < tests.length; t++)
        {
            String tst="t"+tests[t];
            try
            {
                ByteArrayBuffer buffer= new ByteArrayBuffer(tests[t]);
                ByteArrayBuffer content=new ByteArrayBuffer(8192);
                SimpleBuffers buffers=new SimpleBuffers(new Buffer[]{buffer,content});

                Handler handler = new Handler();
                HttpParser parser= new HttpParser(buffers,io, handler, buffer.capacity(), content.capacity());
               
               
                io.setInput(http);
               
                parser.parse();
                assertEquals(tst,"GET", f0);
                assertEquals(tst,"/", f1);
                assertEquals(tst,"HTTP/1.0", f2);
View Full Code Here

Examples of org.mortbay.io.bio.StringEndPoint

    }

    public void testResponseParse0()
  throws Exception
    {
        StringEndPoint io=new StringEndPoint();
        io.setInput(
      "HTTP/1.1 200 Correct\015\012"
      + "Content-Length: 10\015\012"
      + "Content-Type: text/plain\015\012"
      + "\015\012"
      + "0123456789\015\012");
View Full Code Here

Examples of org.mortbay.io.bio.StringEndPoint

    }

    public void testResponseParse1()
  throws Exception
    {
        StringEndPoint io=new StringEndPoint();
        io.setInput(
      "HTTP/1.1 304 Not-Modified\015\012"
      + "Connection: close\015\012"
      + "\015\012");
        ByteArrayBuffer buffer= new ByteArrayBuffer(4096);
        SimpleBuffers buffers=new SimpleBuffers(new Buffer[]{buffer});
View Full Code Here

Examples of org.mortbay.io.bio.StringEndPoint

    }

    public void testResponseParse2()
  throws Exception
    {
        StringEndPoint io=new StringEndPoint();
        io.setInput(
      "HTTP/1.1 204 No-Content\015\012"
      + "Connection: close\015\012"
      + "\015\012"
      + "HTTP/1.1 200 Correct\015\012"
      + "Content-Length: 10\015\012"
View Full Code Here

Examples of org.mortbay.io.bio.StringEndPoint

    }

    public void testLineParse1()
  throws Exception
    {
        StringEndPoint io=new StringEndPoint();
        io.setInput("GET /999\015\012");
        ByteArrayBuffer buffer= new ByteArrayBuffer(4096);
        SimpleBuffers buffers=new SimpleBuffers(new Buffer[]{buffer});

        f2= null;
        Handler handler = new Handler();
View Full Code Here

Examples of org.mortbay.io.bio.StringEndPoint

    }

    public void testLineParse2()
  throws Exception
    {
        StringEndPoint io=new StringEndPoint();
        io.setInput("POST /222  \015\012");
        ByteArrayBuffer buffer= new ByteArrayBuffer(4096);
        SimpleBuffers buffers=new SimpleBuffers(new Buffer[]{buffer});

        f2= null;
        Handler handler = new Handler();
View Full Code Here

Examples of org.mortbay.io.bio.StringEndPoint

    }

    public void testLineParse3()
        throws Exception
    {
        StringEndPoint io=new StringEndPoint();
        io.setInput("POST /fo\u0690 HTTP/1.0\015\012" + "\015\012");
        ByteArrayBuffer buffer= new ByteArrayBuffer(4096);
        SimpleBuffers buffers=new SimpleBuffers(new Buffer[]{buffer});

        Handler handler = new Handler();
        HttpParser parser= new HttpParser(buffers,io, handler, buffer.capacity(), 0);
View Full Code Here

Examples of org.mortbay.io.bio.StringEndPoint

    }

    public void testLineParse4()
        throws Exception
    {
        StringEndPoint io=new StringEndPoint();
        io.setInput("POST /foo?param=\u0690 HTTP/1.0\015\012" + "\015\012");
        ByteArrayBuffer buffer= new ByteArrayBuffer(4096);
        SimpleBuffers buffers=new SimpleBuffers(new Buffer[]{buffer});

        Handler handler = new Handler();
        HttpParser parser= new HttpParser(buffers,io, handler, buffer.capacity(), 0);
View Full Code Here

Examples of org.mortbay.io.bio.StringEndPoint

    }

    public void testConnect()
        throws Exception
    {
        StringEndPoint io=new StringEndPoint();
        io.setInput("CONNECT 192.168.1.2:80 HTTP/1.1\015\012" + "\015\012");
        ByteArrayBuffer buffer= new ByteArrayBuffer(4096);
        SimpleBuffers buffers=new SimpleBuffers(new Buffer[]{buffer});

        Handler handler = new Handler();
        HttpParser parser= new HttpParser(buffers,io, handler, buffer.capacity(), 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.