+ fn handle_custom_message(&self, _msg: Self::CustomMessage) {
+ self.num_messages_expected.fetch_sub(1, Ordering::SeqCst);
+ }
+ fn read_custom_message<R: io::Read>(&self, message_type: u64, buffer: &mut R) -> Result<Option<Self::CustomMessage>, DecodeError> where Self: Sized {
+ if message_type == CUSTOM_MESSAGE_TYPE {
+ let buf = read_to_end(buffer)?;
+ assert_eq!(buf, CUSTOM_MESSAGE_CONTENTS);
+ return Ok(Some(TestCustomMessage {}))
+ }
+ Ok(None)
+ }