Sha256: 17b9c43d2afe28624c41458bd588bc79563b41ea2fc2d2b18222bdb657fb2150
Contents?: true
Size: 1.11 KB
Versions: 6
Compression:
Stored size: 1.11 KB
Contents
$logger = Logger.new(File.new('/dev/null', 'w')) callback = proc do |data| data + ":callback" end proxy do |data| if data == 'a' { :remote => "localhost:9980" } elsif data == 'b' { :remote => "localhost:9981" } elsif data == 'c' { :remote => "localhost:9980", :data => 'ccc' } elsif data == 'd' { :close => 'ddd' } elsif data == 'e' * 2048 { :noop => true } elsif data == 'e' * 2048 + 'f' { :remote => "localhost:9980" } elsif data == 'g' { :remote => "localhost:9980", :data => 'g2', :reply => 'g3-' } elsif data == 'h' { :remote => "localhost:9980", :callback => callback } elsif data == 'connect reject' { :remote => "localhost:9989" } elsif data == 'inactivity' { :remote => "localhost:9980", :data => 'sleep 3', :inactivity_timeout => 1 } else { :close => true } end end ERROR_FILE = File.expand_path('../../proxy_error', __FILE__) proxy_connect_error do |remote| File.open(ERROR_FILE, 'wb') { |fd| fd.write("connect error: #{remote}") } end proxy_inactivity_error do |remote| File.open(ERROR_FILE, 'wb') { |fd| fd.write("activity error: #{remote}") } end
Version data entries
6 entries across 6 versions & 1 rubygems