use of org.neo4j.bolt.v1.messaging.BoltRequestMessageReader in project neo4j by neo4j.
the class MessageMatchers method messages.
public static List<RequestMessage> messages(byte[] bytes) throws IOException {
BoltRequestMessageReader unpacker = requestReader(bytes);
BoltRequestMessageRecorder consumer = new BoltRequestMessageRecorder();
try {
while (unpacker.hasNext()) {
unpacker.read(consumer);
}
return consumer.asList();
} catch (Throwable e) {
throw new IOException("Failed to deserialize response, '" + e.getMessage() + "'. Messages read so " + "far: \n" + consumer.asList() + "\n" + "Raw data: \n" + HexPrinter.hex(bytes));
}
}
use of org.neo4j.bolt.v1.messaging.BoltRequestMessageReader in project neo4j by neo4j.
the class BoltRequestMessageTest method serializeAndDeserialize.
private <T extends RequestMessage> T serializeAndDeserialize(T msg) throws IOException {
RecordingByteChannel channel = new RecordingByteChannel();
BoltRequestMessageReader reader = new BoltRequestMessageReader(new Neo4jPack.Unpacker(new BufferedChannelInput(16).reset(channel)));
BoltRequestMessageWriter writer = new BoltRequestMessageWriter(new Neo4jPack.Packer(new BufferedChannelOutput(channel)), NO_BOUNDARY_HOOK);
writer.write(msg).flush();
channel.eof();
return unpack(reader, channel);
}
Aggregations