Use BytesRef.bytesEquals.