title: Dead sessions in apache mina
body: <p>We have a apache mina based GPRS gateway(server). Sometimes, usually when the connection is terminated from client side brutally i.e, power cable unplugged or any other unusual shutdown or some problem with network, it is not removed or closed at server side. It remain there, in idle state, for I don,t know how long( may be forever). 
  At times we face issues while shutting the server down, MINA take too much time and at times we have to kill it eventually. We suspect that this issue is related to dead connection problem.
  <br>Actually, this dead connection make sense. Since the connection is closed brutally and mina don't have a way to check it (that's how tcp session works).
  We as a workaround, devised a solution that we will close session if it remain idle (both read and write) for let say 30 min(or any configurable time). Which we do not like for 2 reasons: 
   <br>1- It doesn't look nice.
   <br>2- Plus we have a rule that client make a persistent connection with the server. So, it's a bit difficult to set an 'idle timeout' as we can't just close any session which has been idle for x min/hrs as it can be a valid connection.
  <br>
  <br>So, is there any nicer and more safer (in our case) way to detect and clean these dead connection in MINA?    </p>