}
@Test
public void loop_decode_twice() {
// prepare
IoSession session = mock(IoSession.class);
ByteBuffer buff = ByteBuffer.wrap("test".getBytes());
Object decodingState = new Object();
when(session.getAttribute(new AttributeKey<Object>(Object.class, "internal_decoder")))
.thenReturn(decodingState);
Object decoded = new Object();
when(decoder.decode(buff, decodingState)).thenReturn(decoded).thenReturn(decoded).thenReturn(null);