direct_channel (Net::SSH::Service::Forward::Driver)

    # File lib/net/ssh/service/forward/driver.rb, line 79
              def direct_channel( local_port, remote_host, remote_port,
                handler, *data )
              # begin
                writer = @buffers.writer
                writer.write_string remote_host
                writer.write_long remote_port.to_i
                writer.write_string "127.0.0.1"
                writer.write_long local_port.to_i

                @direct_channel_count += 1
                @open_direct_channel_count += 1

                if @log.debug?
                  @log.debug "opening direct channel for " +
                    "#{local_port}:#{remote_host}:#{remote_port}"
                end

                c = @connection.open_channel( 'direct-tcpip', writer ) do |channel|
                  if @log.debug?
                    @log.debug "direct channel confirmed for " +
                      "#{local_port}:#{remote_host}:#{remote_port}"
                  end

                  if handler.respond_to?( :on_receive )
                    channel.on_data( &handler.method(:on_receive) )
                  end

                  if handler.respond_to?( :on_eof )
                    channel.on_eof( &handler.method(:on_eof) )
                  end

                  channel.on_close do |ch|
                    @open_direct_channel_count -= 1
                    handler.on_close( ch ) if handler.respond_to?( :on_close )
                  end

                  if handler.respond_to?( :confirm )
                    handler.confirm( channel, local_port, remote_host,
                      remote_port, *data )
                  end

                  if handler.respond_to?( :process )
                    Thread.new { handler.process( channel ) }
                  end
                end

                c.on_confirm_failed do |channel, code,desc,lang|
                  raise Net::SSH::Exception, "could not open direct channel for " +
                    "#{local_port}:#{remote_host}:#{remote_port} (#{code}, #{desc})"
                end

                nil
              end