@Test
    void testCloseClientFactory() throws Exception {
        final ClientFactory factory = ClientFactory.builder().build();
        final WebClient client = WebClient.builder(server.httpUri()).factory(factory).build();
        final HttpRequestWriter req = HttpRequest.streaming(RequestHeaders.of(HttpMethod.GET,
                                                                              "/stream-closed"));
        final HttpResponse res = client.execute(req);
        final AtomicReference<HttpObject> obj = new AtomicReference<>();
        res.subscribe(new Subscriber<HttpObject>() {
            @Override
            public void onSubscribe(Subscription s) {
                s.request(Long.MAX_VALUE);
            }

            @Override
            public void onNext(HttpObject httpObject) {
                obj.set(httpObject);
            }

            @Override
            public void onError(Throwable t) {
            }

            @Override
            public void onComplete() {
            }
        });
        req.write(HttpData.ofUtf8("not finishing this stream, sorry."));
        await().untilAsserted(() -> assertThat(obj).hasValue(ResponseHeaders.of(HttpStatus.OK)));
        factory.close();
        await().until(() -> completed);
    }
User-agent header should be overridden by ClientOption.HTTP_HEADER
core/src/test/java/com/linecorp/armeria/client/HttpClientIntegrationTest.java