new (Net::SFTP::Session)

    # File lib/net/sftp/session.rb, line 36
        def initialize( session )
          @session = session
          @log = @session.registry.log_for( "sftp.session" )

          @session.registry.namespace_define :sftp do |ns|
            ns.require "net/sftp/protocol/services", "Net::SFTP::Protocol"
            ns.require "net/sftp/operations/services", "Net::SFTP::Operations"

            # register a reference to myself for other services to be able to
            # access me.
            ns.session( :pipeline => [] ) { self }

            @driver = ns.protocol.driver
            @driver.on_open do |d|
              d.on_attrs( &method( :do_attrs  ))
              d.on_data(  &method( :do_data   ))
              d.on_handle(&method( :do_handle ))
              d.on_name(  &method( :do_name   ))
              d.on_status(&method( :do_status ))

              if block_given?
                begin
                  yield self
                ensure
                  d.close
                end
              end
            end

            @operations = ns.operations
          end

          @requests = Hash.new

          @session.loop if block_given?
        end