{"id":48680782,"url":"https://github.com/biasedbit/http-client","last_synced_at":"2026-04-26T20:00:40.691Z","repository":{"id":144849170,"uuid":"4017178","full_name":"biasedbit/http-client","owner":"biasedbit","description":"A Java high performance throughput-oriented HTTP client library based on Netty.","archived":true,"fork":false,"pushed_at":"2014-12-26T17:18:16.000Z","size":745,"stargazers_count":89,"open_issues_count":0,"forks_count":30,"subscribers_count":16,"default_branch":"master","last_synced_at":"2023-03-22T12:21:10.395Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://biasedbit.com","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/biasedbit.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-04-13T15:28:40.000Z","updated_at":"2023-03-23T01:27:19.557Z","dependencies_parsed_at":"2023-03-23T01:31:09.954Z","dependency_job_id":null,"html_url":"https://github.com/biasedbit/http-client","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/biasedbit/http-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biasedbit%2Fhttp-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biasedbit%2Fhttp-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biasedbit%2Fhttp-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biasedbit%2Fhttp-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/biasedbit","download_url":"https://codeload.github.com/biasedbit/http-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biasedbit%2Fhttp-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32310804,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T19:15:34.056Z","status":"ssl_error","status_checked_at":"2026-04-26T19:15:15.467Z","response_time":129,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-11T01:00:36.064Z","updated_at":"2026-04-26T20:00:40.675Z","avatar_url":"https://github.com/biasedbit.png","language":"Java","funding_links":[],"categories":["网络编程"],"sub_categories":["Spring Cloud框架"],"readme":"FOREWARNING: This project is no longer maintained. Kept online for educational purposes only.\n\nHTTP client\n===========\n\nThis project is a Java high performance and throughput oriented HTTP client library, with support for HTTP 1.1 pipelining.\nIt was developed mostly towards server-side usage, where speed and low resource usage are the key factors, but can be used to build client applications as well.\n\nBuilt on top of Netty and designed for high concurrency scenarios where multiple threads can use the same instance of a client without any worries for external or internal synchronization, it helps you reduce initialization and/or preparation times and resource squandering.\nAmong many small optimizations, connections are reused whenever possible, which results in a severe reduction of total request execution times by cutting connection establishment overhead.\n\n\n### Version 1.1 is nearly ready\n\nBe sure to check the [change log](CHANGES.md). The user-facing API has remained pretty much the same apart from some class renaming \u0026mdash; the transition should be smooth.\n\n\n## Dependencies\n\n* JDK 1.7\n* [Netty 3.6](http://netty.io/downloads/)\n* [Lombok 1.6](http://projectlombok.org)\n\n\n## Usage examples\n\n### Synchronous mode\n\nThis example contains all the steps to execute a request, from creation to cleanup.\nThis is the synchronous mode, which means that the calling thread will block until the request completes.\n\n```java\n// Create \u0026 initialise the client\nHttpClient client = new DefaultHttpClient();\nclient.init();\n\n// Setup the request\nHttpRequest request = new DefaultHttpRequest(HTTP_1_0, GET, \"/\");\n\n// Execute the request, turning the result into a String\nRequestFuture\u003cString\u003e future = client.execute(\"biasedbit.com\", 80, request, new BodyAsStringProcessor());\nfuture.awaitUninterruptibly();\n// Print some details about the request\nSystem.out.println(future);\n    \n// If response was \u003e= 200 and \u003c= 299, print the body (a String)\nif (future.hasSuccessfulResponse()) System.out.println(future.getProcessedResult());\n\n// Cleanup\nclient.terminate();\n```\n\n### Asynchronous mode (recommended)\n\nIn asynchronous mode, an event listener is attached to the object returned by the http client when a request execution is submitted. Attaching this listener allows the programmer to define some computation to occur when the request finishes.\n\n```java\n// Execute an asynchronous request, JDK 8 syntax\nRequestFuture\u003cString\u003e future = client.execute(\"biasedbit.com\", 80, request, new BodyAsStringProcessor());\nfuture.addListener((future) -\u003e {\n        System.out.println(future);\n        if (future.hasSuccessfulResponse()) System.out.println(future.getProcessedResult());\n        client.terminate();\n    }\n});\n\n// Execute an asynchronous request\nRequestFuture\u003cString\u003e future = client.execute(\"biasedbit.com\", 80, request, new BodyAsStringProcessor());\nfuture.addListener(new RequestFutureListener\u003cString\u003e() {\n    @Override public void operationComplete(RequestFuture\u003cString\u003e future)\n            throws Exception {\n        System.out.println(future);\n        if (future.hasSuccessfulResponse()) System.out.println(future.getProcessedResult());\n        client.terminate();\n    }\n});\n```\n\n\u003e **NOTE:** you should **never** perform non-CPU bound operations in the listeners.\n\n### Integration with IoC containers\n\nIoC compliance was paramount when developing this library.\n\nHere's a simple example of how to configure a client in [Spring](http://www.springsource.org/):\n\n```xml\n\u003cbean id=\"httpClient\" class=\"com.biasedbit.http.client.DefaultHttpClient\"\n      init-method=\"init\" destroy-method=\"terminate\"\u003e\n  \u003cproperty ... /\u003e\n\u003c/bean\u003e\n```\n\nOr using a client factory, in case you want multiple clients:\n\n```xml\n\u003cbean id=\"httpClientFactory\" class=\"com.biasedbit.http.client.factory.DefaultHttpClientFactory\"\u003e\n  \u003cproperty ... /\u003e\n\u003c/bean\u003e\n```\n\n`HttpClientFactory` instances will configure each client produced exactly how they were configured - they have the same options as (or more than) the `HttpClient`s they generate.\nInstead of having some sort of configuration object, you configure the factory and then call `createClient()` in it to obtain a pre-configured client.\n\nYou can also create a client for a component, based on a predefined factory:\n\n```xml\n\u003cbean id=\"someBean\" class=\"com.biasedbit.SomeComponent\"\u003e\n  \u003cproperty name=\"httpClient\"\u003e\n    \u003cbean factory-bean=\"httpClientFactory\" factory-method=\"createClient\" /\u003e\n  \u003c/property\u003e\n  \u003cproperty ... /\u003e\n\u003c/bean\u003e\n```\n\nNote that you can accomplish the same effect as the factory example by simply using an abstract definition of a `HttpClient` bean and then using Spring inheritance.\n\n\n## Test coverage status\n\nThis project has a battery of unit and integration tests created with [Spock Framework](https://github.com/spockframework/spock).\n\nThe current coverage, as reported by IntelliJ IDEA is around **92%**. Keep in mind this project uses Lombok, so there is some auto-generated code (getters \u0026 setters, constructors) that is not tested.\n\nThis project is also configured with [pitest](http://pitest.org) through [gradle-pitest-plugin](http://gradle-pitest-plugin.solidsoft.info/). The coverage reported by pitest is **81%**, with **55%** mutation coverage.\n\nTo run the mutation test target and check the report, run the following:\n\n```bash\n$ gradle pitest\n$ open build/reports/pitest/\u003cmost recent date\u003e/index.html\n```\n\n\u003e The difference in coverage reported by IDEA and pitest's reports is due to the use of Lombok (IDEA reports coverage on original source code and pitest reports coverage on de-lombok'd (expanded) code.\n\n\n## License\n\nThis project is licensed under the [Apache License version 2.0](http://www.apache.org/licenses/LICENSE-2.0) as published by the Apache Software Foundation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiasedbit%2Fhttp-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbiasedbit%2Fhttp-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiasedbit%2Fhttp-client/lists"}