def pop(non_block = false)
      buffer_from_socket_nonblock
      message = message_from_buffer_nonblock
      unless non_block
        # we can block
        while message.nil?
          r, _d, _d = IO.select([@socket])
          if r && r[0] == @socket
            buffer_from_socket_nonblock
            message = message_from_buffer_nonblock
          end
        end
      end
      message
    end
def pop(non_block = false)
      buffer_from_socket_nonblock
      message = message_from_buffer_nonblock
      unless non_block
        # we can block
        while message.nil?
          r, _d, _d = IO.select([@socket])
          if r && r[0] == @socket
            buffer_from_socket_nonblock
            message = message_from_buffer_nonblock
          end
        end
      end
      message
    end
TODO: failure modes

 If _non_block_ is true, return nil instead of waiting
 EOFError may be raised