static void setHttp2Authority(String authority, Http2Headers out) {
        // The authority MUST NOT include the deprecated "userinfo" subcomponent
        if (authority != null) {
            if (authority.isEmpty()) {
                out.authority(EMPTY_STRING);
            } else {
                int start = authority.indexOf('@') + 1;
                int length = authority.length() - start;
                if (length == 0) {
                    throw new IllegalArgumentException("authority: " + authority);
                }
                out.authority(new AsciiString(authority, start, length));
            }
        }
    }
@Test
    public void setHttp2AuthorityNullOrEmpty() {
        Http2Headers headers = new DefaultHttp2Headers();

        HttpConversionUtil.setHttp2Authority(null, headers);
        assertNull(headers.authority());

        // https://datatracker.ietf.org/doc/html/rfc9113#section-8.3.1
        // Clients that generate HTTP/2 requests directly MUST use the ":authority" pseudo-header
        // field to convey authority information, unless there is no authority information to convey
        // (in which case it MUST NOT generate ":authority").
        // An intermediary that forwards a request over HTTP/2 MUST construct an ":authority" pseudo-header
        // field using the authority information from the control data of the original request, unless the
        // original request's target URI does not contain authority information
        // (in which case it MUST NOT generate ":authority").
        assertThrows(Http2Exception.class, new Executable() {
            @Override
            public void execute() {
                HttpConversionUtil.setHttp2Authority("", new DefaultHttp2Headers());
            }
        });
    }