The ErrorGeneratingFilter is an IoFilter
with to introduce random error in your data streams. The filter can insert/delete/modify bytes from the data stream with a specified probability.
To use an ErrorGeneratingFilter:
For activate the change of some bytes in your IoBuffer
, for a probability of 200 out of 1000 IoBuffer processed :
or activate the insertion of some bytes in your IoBuffer
, for a probability of 200 out of 1000 :
And for the removing of some bytes :
You can activate the error generation for write or read with the following methods :
Now add it to filter chain, it'll generate the error at the given probability.