use of org.apache.cassandra.exceptions.UnknownColumnException in project cassandra by apache.
the class ConnectionTest method testRecoverableCorruptedMessageDelivery.
@Test
public void testRecoverableCorruptedMessageDelivery() throws Throwable {
test((inbound, outbound, endpoint) -> {
int version = outbound.settings().acceptVersions.max;
if (version < VERSION_40)
return;
AtomicInteger counter = new AtomicInteger();
unsafeSetSerializer(Verb._TEST_1, () -> new IVersionedSerializer<Object>() {
public void serialize(Object o, DataOutputPlus out, int version) throws IOException {
out.writeInt((Integer) o);
}
public Object deserialize(DataInputPlus in, int version) throws IOException {
if (counter.getAndIncrement() == 3)
throw new UnknownColumnException("");
return in.readInt();
}
public long serializedSize(Object o, int version) {
return Integer.BYTES;
}
});
// Connect
connect(outbound);
CountDownLatch latch = new CountDownLatch(4);
unsafeSetHandler(Verb._TEST_1, () -> message -> latch.countDown());
for (int i = 0; i < 5; i++) outbound.enqueue(Message.out(Verb._TEST_1, 0xffffffff));
latch.await(10, SECONDS);
Assert.assertEquals(0, latch.getCount());
Assert.assertEquals(6, counter.get());
});
}
Aggregations