FIXMessageDecoder implements MessageDecoder { @Override public MessageDecoderResult decodable(IoSession session, IoBuffer in) { boolean hasHeader = HEADER_PATTERN.find(in, in.position()) != -1L; return hasHeader ? MessageDecoderResult.OK : (in.remaining() > MAX_UNDECODED_DATA_LENGTH ? MessageDecoderResult.NOT_OK : MessageDecoderResult.NEED_DATA); } FIXMessageDecoder();  FIXMessageDecoder(String charset);  FIXMessageDecoder(String charset, String delimiter); @Override MessageDecoderResult decodable(IoSession session, IoBuffer in); @Override MessageDecoderResult decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out); @Override void finishDecode(IoSession session, ProtocolDecoderOutput out); List<String> extractMessages(File file); void extractMessages(File file, final MessageListener listener);  }
@Test public void testPartialHeader() throws Exception { setUpBuffer("8=FIX.4.2"); assertEquals("wrong result", MessageDecoderResult.NEED_DATA, decoder .decodable(null, buffer)); }
@Test public void testPartialHeader2() throws Exception { setUpBuffer("8=FIX.4.2\0019"); assertEquals("wrong result", MessageDecoderResult.NEED_DATA, decoder .decodable(null, buffer)); }
@Test public void testPartialHeaderFixt() throws Exception { setUpBuffer("8=FIXT.1.1\0019"); assertEquals("wrong result", MessageDecoderResult.NEED_DATA, decoder .decodable(null, buffer)); }
@Test public void testGarbageData() throws Exception { setUpBuffer(new byte[8192]); MessageDecoderResult result = decoder.decodable(null, buffer); assertEquals(result, MessageDecoderResult.NOT_OK); }