use of org.neo4j.bolt.packstream.BufferedChannelOutput in project neo4j by neo4j.
the class TransportErrorIT method shouldHandleUnknownMessages.
@ParameterizedTest(name = "{displayName} {2}")
@MethodSource("argumentsProvider")
public void shouldHandleUnknownMessages(Class<? extends TransportConnection> connectionClass, Neo4jPack neo4jPack, String name) throws Exception {
initParameters(connectionClass, neo4jPack, name);
// Given I send a message with an invalid type
final RecordingByteChannel rawData = new RecordingByteChannel();
final PackStream.Packer packer = new PackStream.Packer(new BufferedChannelOutput(rawData));
// Invalid message type
packer.packStructHeader(1, (byte) 0x66);
packer.pack(1234);
packer.flush();
byte[] invalidMessage = rawData.getBytes();
// When
connection.connect(address).send(util.defaultAcceptedVersions()).send(util.chunk(32, invalidMessage));
// Then
assertThat(connection).satisfies(util.eventuallyReceivesSelectedProtocolVersion());
assertThat(connection).satisfies(eventuallyDisconnects());
}
Aggregations