MockControl mockSessionControl = MockControl.createControl(IoSession.class); IoSession mockSession = (IoSession) mockSessionControl.getMock(); mockSession.getTransportType(); mockSessionControl.setReturnValue(TransportType.SOCKET, MockControl.ONE_OR_MORE);
MockControl mockSessionControl = MockControl.createControl(IoSession.class); IoSession mockSession = (IoSession) mockSessionControl.getMock();  mockSession.getAttribute("org.apache.mina.filter.codec.CumulativeProtocolDecoder.Buffer"); mockSessionControl.setReturnValue(otherBuffer, MockControl.ONE_OR_MORE);  mockSessionControl.replay();
    public void testMinaDemux() throws Exception {        DemuxingProtocolCodecFactory codecFactory = new DemuxingProtocolCodecFactory();        codecFactory.register(FIXMessageDecoder.class);        ProtocolDecoder decoder = codecFactory.getDecoder();        ProtocolDecoderOutputForTest output = new ProtocolDecoderOutputForTest();        MockControl mockSessionControl = MockControl.createControl(IoSession.class);        IoSession mockSession = (IoSession) mockSessionControl.getMock();        mockSession.getTransportType();        mockSessionControl.setReturnValue(TransportType.SOCKET, MockControl.ONE_OR_MORE);        mockSessionControl.replay();        int count = 5;        String data = "";        for (int i = 0; i < count; i++) {            data += "8=FIX.4.2\0019=12\00135=X\001108=30\00110=036\001";        }        for (int i = 1; i < data.length(); i++) {            String chunk1 = data.substring(0, i);            String chunk2 = data.substring(i);            setUpBuffer(chunk1);            decoder.decode(mockSession, buffer, output);            buffer.compact();            setUpBuffer(chunk2);            decoder.decode(mockSession, buffer, output);            assertEquals("wrong message count", count, output.getMessageCount());                        output.reset();            buffer.clear();        }        mockSessionControl.verify();    }