# File lib/net/ssh/session.rb, line 162
      def open_channel( type="session", data=nil, &block )
        sanity_check
        channel = @connection.open_channel( type, data )
        channel.on_confirm_open(&block)

        # If we have an agent, and agent-forwarding is enabled, set up
        # the forwarding. Do this once only, after the first channel
        # is opened.
        if @forward_agent && @registry[:userauth].agent
          unless @agent_forwarded
            agentforward.request
            @agent_forwarded = true
          end
        end

        channel
      end