2013-04-08 20:18:21 +02:00
|
|
|
require 'pathname'
|
|
|
|
$: << Pathname.new( __FILE__).dirname.join( '..', 'lib').to_s
|
|
|
|
|
2013-04-08 19:46:42 +02:00
|
|
|
module NSCA
|
2013-04-08 20:18:21 +02:00
|
|
|
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
|
2013-04-08 19:46:42 +02:00
|
|
|
sock = serv.accept
|
|
|
|
sock.fetch
|
|
|
|
ensure
|
|
|
|
sock.close if sock
|
|
|
|
serv.close if serv
|
|
|
|
end
|
|
|
|
end
|