@UnstableApi
    @SuppressWarnings("unchecked")
    public Endpoint withAttrs(Attributes newAttributes) {
        requireNonNull(newAttributes, "newAttributes");
        if (newAttributes.isEmpty()) {
            return this;
        }
        if (attrs().isEmpty()) {
            return replaceAttrs(newAttributes);
        }
        final AttributesBuilder builder = attrs().toBuilder();
        newAttributes.attrs().forEachRemaining(entry -> {
            final AttributeKey<Object> key = (AttributeKey<Object>) entry.getKey();
            builder.set(key, entry.getValue());
        });
        return new Endpoint(type, host, ipAddr, port, weight, builder.build());
    }
Returns a new {@link Endpoint} with the specified {@link Attributes}.
Note that the {@link #attrs()} of this {@link Endpoint} is merged with the specified
{@link Attributes}. For attributes with the same {@link AttributeKey}, the attribute
in {@param newAttributes} has higher precedence.
core/src/main/java/com/linecorp/armeria/client/Endpoint.java