Class: Iudex::HTTP::Test::BrokenServer
- Inherits:
-
Object
- Object
- Iudex::HTTP::Test::BrokenServer
- Defined in:
- lib/iudex-http-test/broken_server.rb
Instance Attribute Summary collapse
-
#port ⇒ Object
Returns the value of attribute port.
Instance Method Summary collapse
- #accept ⇒ Object
-
#initialize ⇒ BrokenServer
constructor
A new instance of BrokenServer.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize ⇒ BrokenServer
Returns a new instance of BrokenServer.
26 27 28 29 30 |
# File 'lib/iudex-http-test/broken_server.rb', line 26 def initialize @port = 19293 @server = nil @log = RJack::SLF4J[ self.class ] end |
Instance Attribute Details
#port ⇒ Object
Returns the value of attribute port.
24 25 26 |
# File 'lib/iudex-http-test/broken_server.rb', line 24 def port @port end |
Instance Method Details
#accept ⇒ Object
36 37 38 39 40 41 |
# File 'lib/iudex-http-test/broken_server.rb', line 36 def accept sock = @server.accept yield sock if block_given? rescue Errno::EPIPE => x @log.warn( "In accept:", x ) end |
#start ⇒ Object
32 33 34 |
# File 'lib/iudex-http-test/broken_server.rb', line 32 def start @server = TCPServer.new( @port ) end |
#stop ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/iudex-http-test/broken_server.rb', line 43 def stop if @server @server.close @server = nil true end end |