def read_data(socket, length)
      data = socket.read(length)
      unless data
        raise Errors::ConnectionFailure.new(
          "Attempted to read #{length} bytes from the socket but nothing was returned."
        )
      end
      if data.length < length
        data << read_data(socket, length - data.length)
      end
      data
    end
def read_data(socket, length)
      data = socket.read(length)
      unless data
        raise Errors::ConnectionFailure.new(
          "Attempted to read #{length} bytes from the socket but nothing was returned."
        )
      end
      if data.length < length
        data << read_data(socket, length - data.length)
      end
      data
    end
Read data from the socket until we get back the number of bytes that we
 are expecting.

 @api private

 @example Read the number of bytes.
   connection.read_data(socket, 36)

 @param [ TCPSocket ] socket The socket to read from.
 @param [ Integer ] length The number of bytes to read.

 @return [ String ] The read data.

 @since 1.2.9