# File lib/net/ssh/connection/driver.rb, line 214
        def do_channel_open( response )
          ch_type = response.read_string
          @log.debug "CHANNEL_OPEN recieved (#{ch_type})" if @log.debug?
          handled = false

          sender_channel = response.read_long
          window_size = response.read_long
          packet_size = response.read_long

          channel = @factories[:create].call( ch_type, sender_channel,
                        window_size, packet_size )

          ( @channel_open_handlers[ ch_type ] || [] ).each do |handler|
            next unless handler
            handled = true
            handler.call( self, channel, response )
          end

          unless handled
            raise Net::SSH::Exception,
              "cannot handle request to open a channel of type '#{ch_type}'"
          end

          @channel_map[channel.local_id] = channel

          writer = @buffers.writer
          writer.write_byte CHANNEL_OPEN_CONFIRMATION
          writer.write_long channel.remote_id
          writer.write_long channel.local_id
          writer.write_long 0x7FFFFFFF
          writer.write_long 0x7FFFFFFF
          @session.send_message writer
        end