WebSocketMessageDecoder implements Decoder.Text<Message> { @Override public boolean willDecode(String eventStr) { try { String type = objMapper.readTree(eventStr).get("type").asText(); if (MESSAGE_TYPE_SLACK.equals(type)) { return true; } } catch (IOException e) { LOG.error("Could not determine type for {}. Will not process event...", eventStr); return false; } return false; }  @Override void init(EndpointConfig config); @Override Message decode(String event); @Override boolean willDecode(String eventStr); @Override void destroy();  }
@Test public void testWillDecode() { assertTrue(underTest.willDecode(messageJsonStr)); assertFalse(underTest.willDecode("{\"type\": \"hello\"}")); assertFalse(underTest.willDecode("bad message string")); }