Class: Telnet::ClientChannelInitializer
Overview
The ClientChannelInitializer class
Instance Attribute Summary collapse
-
#decoder ⇒ Object
Returns the value of attribute decoder.
-
#encoder ⇒ Object
Returns the value of attribute encoder.
Instance Method Summary collapse
- #default_handler ⇒ Object
- #frame_decoder ⇒ Object
- #initChannel(channel) ⇒ Object
-
#initialize(host, port, options = {}) ⇒ ClientChannelInitializer
constructor
A new instance of ClientChannelInitializer.
- #ssl_context ⇒ Object
- #ssl_handler(channel) ⇒ Object
Constructor Details
#initialize(host, port, options = {}) ⇒ ClientChannelInitializer
Returns a new instance of ClientChannelInitializer.
356 357 358 359 360 361 362 363 |
# File 'lib/telnet_client.rb', line 356 def initialize(host, port, = {}) super() @host = host @port = port @options = @decoder = StringDecoder.new @encoder = StringEncoder.new end |
Instance Attribute Details
#decoder ⇒ Object
Returns the value of attribute decoder.
354 355 356 |
# File 'lib/telnet_client.rb', line 354 def decoder @decoder end |
#encoder ⇒ Object
Returns the value of attribute encoder.
354 355 356 |
# File 'lib/telnet_client.rb', line 354 def encoder @encoder end |
Instance Method Details
#default_handler ⇒ Object
365 366 367 |
# File 'lib/telnet_client.rb', line 365 def default_handler @default_handler ||= ::Telnet::ModularHandler.new end |
#frame_decoder ⇒ Object
378 379 380 |
# File 'lib/telnet_client.rb', line 378 def frame_decoder DelimiterBasedFrameDecoder.new(@options[:max_frame_length], @options[:delimiter]) end |
#initChannel(channel) ⇒ Object
369 370 371 372 373 374 375 376 |
# File 'lib/telnet_client.rb', line 369 def initChannel(channel) pipeline = channel.pipeline() pipeline.addLast(ssl_handler(channel)) if @options[:ssl] # pipeline.addLast(frame_decoder) pipeline.addLast(decoder) pipeline.addLast(encoder) pipeline.addLast(default_handler) end |
#ssl_context ⇒ Object
386 387 388 |
# File 'lib/telnet_client.rb', line 386 def ssl_context nil # TODO: Implement end |
#ssl_handler(channel) ⇒ Object
382 383 384 |
# File 'lib/telnet_client.rb', line 382 def ssl_handler(channel) ssl_context&.newHandler(channel.alloc(), @host, @port) end |