code: private static void completeConnection(IoSession session, RTMPMinaConnection conn, RTMP rtmp, OutboundHandshake handshake) {
          if (handshake.useEncryption()) {
              // set encryption flag the rtmp state
              rtmp.setEncrypted(true);
              // add the ciphers
              log.debug("Adding ciphers to the session");
              session.setAttribute(RTMPConnection.RTMPE_CIPHER_IN, handshake.getCipherIn());
              session.setAttribute(RTMPConnection.RTMPE_CIPHER_OUT, handshake.getCipherOut());
          }
          // set state to indicate we're connected
          conn.getState().setState(RTMP.STATE_CONNECTED);
          log.debug("Connected, removing handshake data");
          // remove handshake from session now that we are connected
          session.removeAttribute(RTMPConnection.RTMP_HANDSHAKE);
          // add protocol filter as the last one in the chain
          log.debug("Adding RTMP protocol filter");
          session.getFilterChain().addAfter("rtmpeFilter", "protocolFilter", new ProtocolCodecFilter(new RTMPMinaCodecFactory()));
          // get the rtmp handler
          BaseRTMPClientHandler handler = (BaseRTMPClientHandler) session.getAttribute(RTMPConnection.RTMP_HANDLER);
          handler.connectionOpened(conn);
      }
docs: Provides connection completion.
  
  @param session
  @param conn
  @param rtmp
  @param handshake