session.setClosed(false);
// if we have a session timeout set, cancel it.
Timeout timeOut = session.removeTimeout();
if (timeOut != null)
timeOut.cancel();
// check if the session is already connected to a channel
Channel c = pipeline.getChannel();
if (c != null && c.isOpen())
{