Search in sources :

Example 1 with BufferedChannelInput

use of org.neo4j.bolt.v1.packstream.BufferedChannelInput in project neo4j by neo4j.

the class BoltResponseMessageTest method serializeAndDeserialize.

private <T extends ResponseMessage> T serializeAndDeserialize(T msg) throws IOException {
    RecordingByteChannel channel = new RecordingByteChannel();
    BoltResponseMessageReader reader = new BoltResponseMessageReader(new Neo4jPack.Unpacker(new BufferedChannelInput(16).reset(channel)));
    BoltResponseMessageWriter writer = new BoltResponseMessageWriter(new Neo4jPack.Packer(new BufferedChannelOutput(channel)), NO_BOUNDARY_HOOK);
    msg.dispatch(writer);
    writer.flush();
    channel.eof();
    return unpack(reader, channel);
}
Also used : BufferedChannelInput(org.neo4j.bolt.v1.packstream.BufferedChannelInput) BufferedChannelOutput(org.neo4j.bolt.v1.packstream.BufferedChannelOutput)

Example 2 with BufferedChannelInput

use of org.neo4j.bolt.v1.packstream.BufferedChannelInput 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);
}
Also used : BufferedChannelInput(org.neo4j.bolt.v1.packstream.BufferedChannelInput) BufferedChannelOutput(org.neo4j.bolt.v1.packstream.BufferedChannelOutput)

Aggregations

BufferedChannelInput (org.neo4j.bolt.v1.packstream.BufferedChannelInput)2 BufferedChannelOutput (org.neo4j.bolt.v1.packstream.BufferedChannelOutput)2