@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());
 }
示例#2
0
 @Override
 public void onPostAdd(IoFilterChain parent, String name, NextFilter nextFilter)
     throws SSLException {
   if (autoStart) {
     initiateHandshake(nextFilter, parent.getSession());
   }
 }
示例#3
0
 @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);
 }
示例#4
0
  @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());
  }
示例#5
0
  @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);
  }
示例#6
0
 @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);
 }