Class: Telnet::ModularHandler
- Inherits:
-
SimpleChannelInboundHandler
- Object
- SimpleChannelInboundHandler
- Telnet::ModularHandler
show all
- Includes:
- Listenable
- Defined in:
- lib/telnet_client.rb
Overview
Constant Summary
collapse
- IdentiferTemplate =
'#<%<class>s:0x%<id>s>'.freeze
Instance Method Summary
collapse
Methods included from Listenable
#add_listener, #listeners, #notify, #remove_listener
Instance Method Details
#channelActive(ctx) ⇒ Object
275
276
277
278
279
|
# File 'lib/telnet_client.rb', line 275
def channelActive(ctx)
::Telnet.log.info "Channel active #{ctx.channel}"
notify :channel_active, ctx
super(ctx)
end
|
#channelInactive(ctx) ⇒ Object
281
282
283
284
285
|
# File 'lib/telnet_client.rb', line 281
def channelInactive(ctx)
log.trace "##{__method__} channel: #{ctx.channel}"
notify :channel_inactive, ctx
super(ctx)
end
|
#channelRead(ctx, msg) ⇒ Object
292
293
294
295
296
|
# File 'lib/telnet_client.rb', line 292
def channelRead(ctx, msg)
log.trace "##{__method__} channel: #{ctx.channel}, message: #{msg.inspect}"
notify :channel_read, ctx, msg
super(ctx, msg)
end
|
#channelRead0(ctx, msg) ⇒ Object
Please keep in mind that this method will be renamed to messageReceived(ChannelHandlerContext, I) in 5.0.
java_signature ‘protected abstract void channelRead0(ChannelHandlerContext ctx, I msg) throws Exception’
302
303
304
305
|
# File 'lib/telnet_client.rb', line 302
def channelRead0(ctx, msg)
log.trace "##{__method__} channel: #{ctx.channel}, message: #{msg.inspect}"
messageReceived(ctx, msg)
end
|
#channelReadComplete(ctx) ⇒ Object
307
308
309
310
311
|
# File 'lib/telnet_client.rb', line 307
def channelReadComplete(ctx)
log.trace "##{__method__} channel: #{ctx.channel}"
notify :channel_read_complete, ctx
super(ctx)
end
|
#channelRegistered(ctx) ⇒ Object
263
264
265
266
267
|
# File 'lib/telnet_client.rb', line 263
def channelRegistered(ctx)
log.trace "##{__method__} channel: #{ctx.channel}"
notify :channel_registered, ctx
super(ctx)
end
|
#channelUnregistered(ctx) ⇒ Object
269
270
271
272
273
|
# File 'lib/telnet_client.rb', line 269
def channelUnregistered(ctx)
log.trace "##{__method__} channel: #{ctx.channel}"
notify :channel_unregistered, ctx
super(ctx)
end
|
#channelWritabilityChanged(ctx) ⇒ Object
313
314
315
316
317
|
# File 'lib/telnet_client.rb', line 313
def channelWritabilityChanged(ctx)
log.trace "##{__method__} channel: #{ctx.channel}"
notify :channel_writability_changed, ctx
super(ctx)
end
|
#exceptionCaught(ctx, cause) ⇒ Object
325
326
327
328
329
|
# File 'lib/telnet_client.rb', line 325
def exceptionCaught(ctx, cause)
::Telnet.log.warn "##{__method__} channel: #{ctx.channel}, cause: #{cause.message}"
listeners = notify :exception_caught, ctx, cause
super(ctx, cause) if listeners.empty?
end
|
#isSharable ⇒ Object
259
260
261
|
# File 'lib/telnet_client.rb', line 259
def isSharable
true
end
|
#messageReceived(ctx, msg) ⇒ Object
287
288
289
290
|
# File 'lib/telnet_client.rb', line 287
def messageReceived(ctx, msg)
log.trace "##{__method__} channel: #{ctx.channel}, message: #{msg.inspect}"
notify :message_received, ctx, msg
end
|
#to_s ⇒ Object
Also known as:
inspect
333
334
335
|
# File 'lib/telnet_client.rb', line 333
def to_s
format(IdentiferTemplate, class: self.class.name, id: object_id.to_s(16))
end
|
#userEventTriggered(ctx, evt) ⇒ Object
319
320
321
322
323
|
# File 'lib/telnet_client.rb', line 319
def userEventTriggered(ctx, evt)
log.trace "##{__method__} channel: #{ctx.channel}, event: #{evt}"
notify :user_event_triggered, ctx, evt
super(ctx, evt)
end
|