On Fri, 2007-07-27 at 11:10 +0200, Jeroen Verhagen wrote:
> Hi Roland and Oleg,
>
> First thanks for you prompt reactions!
>
> On 7/27/07, Oleg Kalnichevski <[EMAIL PROTECTED]> wrote:
> >
> > There are plenty of test cases in HttpCore that make use of mock HTTP
> > connections (bound to a file or an array of bytes instead of a socket)
> > to exercise HTTP message parsing code. You could use those as a starting
> > point:
>
> I found this testcase in the code:
>
> public void testSimpleParsing() throws Exception {
> HttpParams params = new BasicHttpParams();
> SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128);
> HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
> HttpRequestParser requestParser = new HttpRequestParser(inbuf,
> requestFactory, params);
> requestParser.fillBuffer(newChannel("GET /whatever
> HTTP/1.1\r\nSome header: stuff\r\n\r\n"));
> HttpRequest request = (HttpRequest) requestParser.parse();
> assertNotNull(request);
> assertEquals("/whatever", request.getRequestLine().getUri());
> assertEquals(1, request.getAllHeaders().length);
> }
>
> This looks a lot like what I need for my case. I'm now convinced that
> your directions and HttpCore components I'm gonna solve my problem.
> Thanks!
>
Jeroen,
Be careful. HttpCore supports two I/O models: classic blocking I/O and
non-blocking I/O (NIO). The test case you stumbled upon is for the NIO
transport. You may want to stick to somewhat simpler classic I/O model,
as the ability to process messages asynchronously does not seem to bring
much in your particular case.
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]