def read(num_bytes)
      unless IO.select([@socket], nil, nil, @timeout)
        raise Errno::ETIMEDOUT
      end

      @socket.read(num_bytes)
    rescue IO::EAGAINWaitReadable
      retry
    end
def read(num_bytes)
      unless IO.select([@socket], nil, nil, @timeout)
        raise Errno::ETIMEDOUT
      end

      @socket.read(num_bytes)
    rescue IO::EAGAINWaitReadable
      retry
    end
Opens a socket.

 @param host [String]
 @param port [Integer]
 @param connect_timeout [Integer] the connection timeout, in seconds.
 @param timeout [Integer] the read and write timeout, in seconds.
 @raise [Errno::ETIMEDOUT] if the timeout is exceeded.
 Reads bytes from the socket, possible with a timeout.

 @param num_bytes [Integer] the number of bytes to read.
 @raise [Errno::ETIMEDOUT] if the timeout is exceeded.
 @return [String] the data that was read from the socket.