code: public RTMPConnection createConnectionInstance(Class<?> cls) throws Exception {
          RTMPConnection conn = null;
          if (cls == RTMPMinaConnection.class) {
              conn = (RTMPMinaConnection) cls.newInstance();
          } else if (cls == RTMPTClientConnection.class) {
              conn = (RTMPTClientConnection) cls.newInstance();
          } else {
              conn = (RTMPConnection) cls.newInstance();
          }
          conn.setMaxHandshakeTimeout(maxHandshakeTimeout);
          conn.setMaxInactivity(maxInactivity);
          conn.setPingInterval(pingInterval);
          if (enableTaskExecutor) {
              // setup executor
              ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
              executor.setCorePoolSize(1);
              executor.setDaemon(true);
              executor.setMaxPoolSize(1);
              executor.setQueueCapacity(executorQueueCapacity);
              executor.initialize();
              conn.setExecutor(executor);
          }
          return conn;
      }
docs: Creates a connection instance based on the supplied type.
  
  @param cls
  @return connection
  @throws Exception