Sha256: f2d0b0ff1b94073c565eef39376864f2893ccbd67804edf994ff02557e1434d7

Contents?: true

Size: 864 Bytes

Versions: 1

Compression:

Stored size: 864 Bytes

Contents

require "spec/helper/all"

describe EventMachine::Synchrony::TCPSocket  do
  it 'connects to a TCP port'  do
    EventMachine.synchrony do
      @socket = EventMachine::Synchrony::TCPSocket.new 'eventmachine.rubyforge.org', 80
      @socket.should_not be_error
      EM.stop
    end
  end

  it 'errors on connection failure' do
    EventMachine.synchrony do
      proc {
        EventMachine::Synchrony::TCPSocket.new 'localhost', 12345
      }.should raise_error(SocketError)
      EM.stop
    end
  end

  it 'should accept "send" when wrapped in a connection pool' do
    EventMachine.synchrony do
      @socket = EventMachine::Synchrony::ConnectionPool.new(size: 1) do
        EventMachine::Synchrony::TCPSocket.new 'eventmachine.rubyforge.org', 80
      end
      @socket.send("GET / HTTP1.1\r\n\r\n").class.should be(Fixnum)
      EM.stop
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
em-synchrony-1.0.1 spec/tcpsocket_spec.rb