@UnstableApi
    public <T> Endpoint withAttr(AttributeKey<T> key, @Nullable T value) {
        requireNonNull(key, "key");
        if (attributes == null) {
            if (value == null) {
                return this;
            }
            return replaceAttrs(Attributes.of(key, value));
        }

        if (attributes.attr(key) == value) {
            return this;
        } else {
            final AttributesBuilder attributesBuilder = attributes.toBuilder();
            attributesBuilder.set(key, value);
            return replaceAttrs(attributesBuilder.build());
        }
    }
Returns a new host endpoint with the specified {@link AttributeKey} and value.

@return the new endpoint with the specified {@link AttributeKey} and value. {@code this} if this
        endpoint has the same value with the specified {@link AttributeKey}.
core/src/main/java/com/linecorp/armeria/client/Endpoint.java