ruby-nsca/test/dummy_server.rb

17 lines
370 B
Ruby
Raw Normal View History

require 'pathname'
$: << Pathname.new( __FILE__).dirname.join( '..', 'lib').to_s
module NSCA
def self.dummy_server *args
Dir[ Pathname.new( __FILE__).dirname.join( '..', 'lib', '**').to_s].each_entry do |l|
load l if /\.rb$/ =~ l
end
serv = NSCA::Server.new *args
sock = serv.accept
2013-04-08 20:38:11 +02:00
sock.to_a
ensure
sock.close if sock
serv.close if serv
end
end