Hi Jon,
I'll check it once have time (hopefully later today).
FYI, Ryan is almost completed Grizzly transport implementation for async
http client [1]. We hope to have it published soon.
Thanks.
WBR,
Alexey.
[1]
https://github.com/sonatype/async-http-client
On 07/12/2011 12:59 AM, Jon Brisbin wrote:
> I'm working on a non-blocking HTTP client based on Grizzly and I'm
> having trouble figuring out what I'm doing wrong in my "upload" test.
>
> The source is on github:
>
> https://github.com/jbrisbin/grizzly-http-client
>
> The test I'm having trouble with looks like:
>
> def "Test upload file"() {
>
> given:
> FileChannel input = new
> RandomAccessFile("src/test/files/lorem_ipsum.txt", "r").channel
>
> when:
> Request req = PUT("http://localhost:8098/riak/upload/text")
> req.contentType = "text/plain"
> req.contentLength = input.size()
> WritableByteChannel w = req.start()
> input.transferTo(0, input.size(), w)
> Response resp = await req.complete()
>
> then:
> resp.status == 204
>
> }
>
> I'm using the FileChannel.transferTo() to stream a file from the
> filesystem to a local Riak server. It looks like its sending more data
> than what I'm supposed to, though, because I end up getting an
> additional response back from the server I'm not expecting. Like I'm
> sending all the content I'm supposed to for the initial request, but
> there's extra data somewhere that Riak is interpreting as a new
> request. But it's not a "real" request, so it naturally is giving an
> error response to the filter, which isn't expecting a response from
> the server, so throws an exception. Clear as mud? :)
>
> The request seems to succeed and all the data I'm expecting to see in
> that entry is there. It seems like I'm just sending *more* data than
> I'm supposed to.
>
> Any help here would be greatly appreciated! :)
>
> Thanks!
>
> Jon Brisbin
> http//jbrisbin.com
>
>