@Override public void onPreAdd(IoFilterChain parent, String name, NextFilter nextFilter) throws Exception { if (parent.contains(this)) { throw new IllegalArgumentException( "You can't add the same filter instance more than once. Create another instance and add it."); } parent.getSession().setAttribute(STATE, new State()); adjustReadBufferSize(parent.getSession()); }
@Override public void onPostAdd(IoFilterChain parent, String name, NextFilter nextFilter) throws SSLException { if (autoStart) { initiateHandshake(nextFilter, parent.getSession()); } }
@Override public void onPreRemove(IoFilterChain parent, String name, NextFilter nextFilter) throws SSLException { IoSession session = parent.getSession(); stopSsl(session); session.removeAttribute(NEXT_FILTER); session.removeAttribute(SSL_HANDLER); }
@Override public void onPreAdd(IoFilterChain parent, String name, NextFilter nextFilter) throws Exception { if (parent.contains(this)) { throw new IllegalArgumentException( "You can't add the same filter instance more than once. Create another instance and add it."); } // Initialize the encoder and decoder initCodec(parent.getSession()); }
@Override public void onPreAdd(IoFilterChain parent, String name, NextFilter nextFilter) throws SSLException { if (parent.contains(SslFilter.class)) { throw new IllegalStateException("Only one " + SslFilter.class.getName() + " is permitted."); } IoSession session = parent.getSession(); session.setAttribute(NEXT_FILTER, nextFilter); // Create an SSL handler and start handshake. SslHandler handler = new SslHandler(this, sslContext, (IoSessionEx) session, logger); session.setAttribute(SSL_HANDLER, handler); }
@Override public void onPostRemove(IoFilterChain parent, String name, NextFilter nextFilter) throws Exception { // Clean everything disposeCodec(parent.getSession()); }
@Override public void onPostRemove(IoFilterChain parent, String name, NextFilter nextFilter) throws Exception { parent.getSession().removeAttribute(STATE); }