This PR provides a solution for the bug uncovered by @shamblett in https://github.com/shamblett/coap/issues/132#issuecomment-1288068964. The filtering logic is now moved inside a StreamTransformer object, which adds exceptions to the stream on timeout or cancellation. Similar to your suggestion in the issue, the relevant events are pre-filtered using a new CoapCompletionEvent interface that is "implemented" by the CoapResponse, CoapRequestTimeoutException, and CoapRequestCancellationException classes. Lastly, the PR applies minor refactoring to the matching of the original request and relevant responses.
This PR provides a solution for the bug uncovered by @shamblett in https://github.com/shamblett/coap/issues/132#issuecomment-1288068964. The filtering logic is now moved inside a
StreamTransformer
object, which adds exceptions to the stream on timeout or cancellation. Similar to your suggestion in the issue, the relevant events are pre-filtered using a newCoapCompletionEvent
interface that is "implemented" by theCoapResponse
,CoapRequestTimeoutException
, andCoapRequestCancellationException
classes. Lastly, the PR applies minor refactoring to the matching of the original request and relevant responses.