Hi, Thanks to Emmanuel for your help. I added the LoggingFilter before my codec and I got the following logs : 2010-08-16 15:11:02,988 | INFO | NioProcessor-6 | LoggingFilter | org.apache.mina.filter.logging.LoggingFilter 140 | SENT: HeapBuffer[pos=0 lim=254 cap=254: 3C 3F 78 6D 6C 20 76 65 72 73 69 6F 6E 3D 22 31...] 2010-08-16 15:11:02,988 | INFO | NioProcessor-6 | LoggingFilter | org.apache.mina.filter.logging.LoggingFilter 140 | SENT: HeapBuffer[pos=0 lim=0 cap=0: empty] 2010-08-16 15:11:03,051 | WARN | NioProcessor-6 | LoggingFilter | org.apache.mina.filter.logging.LoggingFilter 122 | EXCEPTION : Session closed....
After that I investigated and I discovered that the request message has a RETURN_LINE character (\n or \r) at the end of the request. I just trimmed the message before send it to the server and I got the right response. Thanks a lot for your ideas. Hamid On Thu, Aug 5, 2010 at 4:21 PM, Emmanuel Lécharny <[email protected]>wrote: > On 8/5/10 3:35 PM, Hamid wrote: > >> Hi, >> >> I'll try to describe more my issue. >> > Thanks ! > > I've implemented a class handler as below : >> > <snip/> > > > myConnector.getFilterChain().addLast("codec", new ProtocolCodecFilter(new >> MyCodecFactory())); >> > It's likely that the problem lies into the MyCodecFactory. Everything else > is just plain normal MINA code. > > > On the console I see that the following logs : >> >> Connection established... >> Request sent... >> Caught exception - The connection was closed.... >> >> BUT my Handler doesn't display anything that means that it has been >> called... >> > It has been called : you got an ExceptionCaught :) > > What happens in your case is that the data have been received, but haven't > be processed up to the Handler, because there is a problem in your decoder. > > To give you some clue about whats going on inside MINA when some bytes are > received, here is the path they follow : > > server-socket --> Head filter --> ... (as many filter you added in the > chain *before* the ProtocolCodecFilter)... --> ProtocolCodecFilter --> ... > Some more filter you may have added)... -> Tail filter --> Handler > > In your case, you don't have any filter before or after the codec. It might > be a good idea to add a LoggingFilter before the codec just for debugging > pruposes : you will be able to see that there are some bytes processed > through the MessageReceived chain. > > Anyway, in your case, I'm ready to bet a beer that the message get blocked > in the codec and never get through it. > > > > > -- > Regards, > Cordialement, > Emmanuel Lécharny > www.iktek.com > >
