use of org.neo4j.bolt.v1.messaging.BoltResponseMessageRecorder in project neo4j by neo4j.
the class MessageMatchers method responseMessage.
public static ResponseMessage responseMessage(byte[] bytes) throws IOException {
BoltResponseMessageReader unpacker = responseReader(bytes);
BoltResponseMessageRecorder consumer = new BoltResponseMessageRecorder();
try {
if (unpacker.hasNext()) {
unpacker.read(consumer);
return consumer.asList().get(0);
}
throw new IllegalArgumentException("Expected a message in `" + HexPrinter.hex(bytes) + "`");
} catch (Throwable e) {
throw new IOException("Failed to deserialize response, '" + e.getMessage() + "'.\n" + "Raw data: \n" + HexPrinter.hex(bytes), e);
}
}
Aggregations