can now run passBybytes, but it's broken
This commit is contained in:
parent
d33af5fa71
commit
9d23cd8cb0
3 changed files with 19 additions and 5 deletions
|
@ -56,10 +56,24 @@ public abstract class TestCase<RequestFactory extends StructFactory<RequestBuild
|
|||
org.capnproto.Serialize.writeMessage(writer, requestMessage);
|
||||
}
|
||||
|
||||
new org.capnproto.ArrayInputStream(requestBytes);
|
||||
{
|
||||
org.capnproto.MessageReader messageReader =
|
||||
org.capnproto.ByteChannelMessageReader.create(new org.capnproto.ArrayInputStream(requestBytes));
|
||||
this.handleRequest(messageReader.getRoot(requestFactory), response);
|
||||
}
|
||||
|
||||
// TODO
|
||||
throw new Error("unimplemented");
|
||||
{
|
||||
org.capnproto.ArrayOutputStream writer = new org.capnproto.ArrayOutputStream(responseBytes);
|
||||
org.capnproto.Serialize.writeMessage(writer, responseMessage);
|
||||
}
|
||||
|
||||
{
|
||||
org.capnproto.MessageReader messageReader =
|
||||
org.capnproto.ByteChannelMessageReader.create(new org.capnproto.ArrayInputStream(responseBytes));
|
||||
if (!this.checkResponse(messageReader.getRoot(responseFactory), expected)) {
|
||||
throw new Error("incorrect response");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ public final class ArrayInputStream implements BufferedInputStream {
|
|||
public final ByteBuffer buf;
|
||||
|
||||
public ArrayInputStream(ByteBuffer buf) {
|
||||
this.buf = buf;
|
||||
this.buf = buf.asReadOnlyBuffer();
|
||||
}
|
||||
|
||||
public final int read(ByteBuffer dst) throws IOException {
|
||||
|
|
|
@ -9,7 +9,7 @@ public final class ArrayOutputStream implements BufferedOutputStream {
|
|||
public final ByteBuffer buf;
|
||||
|
||||
public ArrayOutputStream(ByteBuffer buf) {
|
||||
this.buf = buf;
|
||||
this.buf = buf.duplicate();
|
||||
}
|
||||
|
||||
public final int write(ByteBuffer src) throws IOException {
|
||||
|
|
Loading…
Reference in a new issue