Created
July 30, 2009 00:15
-
-
Save brianm/158466 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HttpExchange exchange = new HttpExchange() { | |
private volatile int count = 0; | |
@Override | |
public InputStream getRequestContentSource() { | |
return new ByteArrayInputStream(new byte[0]); | |
} | |
@Override | |
public Buffer getRequestContentChunk() throws IOException { | |
System.out.println("CHUNK"); | |
switch (count++) { | |
case 0: return new ByteArrayBuffer("hello ".getBytes()); | |
case 1: return new ByteArrayBuffer("world".getBytes()); | |
default: return null; | |
} | |
} | |
}; | |
exchange.setMethod("POST"); | |
exchange.setURL("http://localhost:8000/"); | |
http.send(exchange); | |
exchange.waitForDone(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brianm@binky:~/src/ning-nfs$ nc -v -l 8000 | |
POST / HTTP/1.1 | |
Host: localhost:8000 | |
Content-Length: 0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment