# File lib/net/ssh/service/forward/driver.rb, line 280
          def do_open_channel( connection, channel, data )
            connected_address = data.read_string
            connected_port = data.read_long
            originator_address = data.read_string
            originator_port = data.read_long

            forward_data = @remote_forwards[ connected_port ]
            unless forward_data
              raise Net::SSH::Exception,
                "recieved invalid channel-open command for a port forward " +
                "that was never requested"
            end

            handler = forward_data[:handler]

            forward_data[:channel] = channel

            if handler.respond_to?( :on_open )
              handler.on_open( channel,
                               connected_address, connected_port,
                               originator_address, originator_port )
            end

            channel.on_data( &handler.method(:on_receive) )

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

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