### Question:
HttpConversionUtil { static void setHttp2Authority(String authority, Http2Headers out) { 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)); } } } private  HttpConversionUtil(); static HttpResponseStatus parseStatus(CharSequence status); static FullHttpResponse toHttpResponse(int streamId, Http2Headers http2Headers, ByteBufAllocator alloc,
                                                  boolean validateHttpHeaders); static FullHttpRequest toFullHttpRequest(int streamId, Http2Headers http2Headers, ByteBufAllocator alloc,
                                                boolean validateHttpHeaders); static HttpRequest toHttpRequest(int streamId, Http2Headers http2Headers, boolean validateHttpHeaders); static void addHttp2ToHttpHeaders(int streamId, Http2Headers sourceHeaders,
                    FullHttpMessage destinationMessage, boolean addToTrailer); static void addHttp2ToHttpHeaders(int streamId, Http2Headers inputHeaders, HttpHeaders outputHeaders,
            HttpVersion httpVersion, boolean isTrailer, boolean isRequest); static Http2Headers toHttp2Headers(HttpMessage in, boolean validateHeaders); static Http2Headers toHttp2Headers(HttpHeaders inHeaders, boolean validateHeaders); static void toHttp2Headers(HttpHeaders inHeaders, Http2Headers out); static final HttpMethod OUT_OF_MESSAGE_SEQUENCE_METHOD; static final String OUT_OF_MESSAGE_SEQUENCE_PATH; static final HttpResponseStatus OUT_OF_MESSAGE_SEQUENCE_RETURN_CODE; }### Answer:
@Test public void setHttp2AuthorityWithoutUserInfo() { Http2Headers headers = new DefaultHttp2Headers(); HttpConversionUtil.setHttp2Authority("foo", headers); assertEquals(new AsciiString("foo"), headers.authority()); }
@Test public void setHttp2AuthorityWithUserInfo() { Http2Headers headers = new DefaultHttp2Headers(); HttpConversionUtil.setHttp2Authority("info@foo", headers); assertEquals(new AsciiString("foo"), headers.authority()); HttpConversionUtil.setHttp2Authority("@foo.bar", headers); assertEquals(new AsciiString("foo.bar"), headers.authority()); }
@Test public void setHttp2AuthorityNullOrEmpty() { Http2Headers headers = new DefaultHttp2Headers(); HttpConversionUtil.setHttp2Authority(null, headers); assertNull(headers.authority()); HttpConversionUtil.setHttp2Authority("", headers); assertSame(AsciiString.EMPTY_STRING, headers.authority()); }
@Test(expected = IllegalArgumentException.class) public void setHttp2AuthorityWithEmptyAuthority() { HttpConversionUtil.setHttp2Authority("info@", new DefaultHttp2Headers()); }