public void sessionClosed(SessionFilterChain filterChain) throws Exception {
try {
if (engine != null) {
engine.closeOutbound();
if (!engine.isInboundDone()) {
Packet encodedPacket = encode(filterChain.getSession(),
new HandshakePacket());
if (encodedPacket != null)
encodedPacket.getContent().release();
}
engine.closeInbound();
}
} catch (SSLException ssle) {
throw new SessionException(ssle);