Skip to content

A light and minimalistic HTTP server for Java with zero dependencies and quick startup time

License

Notifications You must be signed in to change notification settings

arteam/embedded-http-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Embedded HTTP server

embedded-http-server is a light and minimalistic Java HTTP server with zero dependencies and quick startup time.

Maven

<dependency>
    <groupId>com.github.arteam</groupId>
    <artifactId>embedded-http-server</artifactId>
    <version>1.2</version>
</dependency>

Description

embedded-http-server is a thin wrapper around com.sun.net.HttpServer. The internal Sun server is quite fast, provides a Java API for accessing requests/responses and already shipped in the JDK. Unfortunately, the API is quite confusing, not documented and the server lacks error reporting. This library tries to solve these issues by providing a nice and functional API for scripting an HTTP server without a long startup time.

Application

The primary use case is integration testing of HTTP clients. You often need to fire up an HTTP server in tests to create a test double for a remote HTTP server. That test double should ideally be rather fast, otherwise you lose the advantage of the quick turnaround time and eventually switch to testing on a "live" system. Some people are also opionated about including huge projects as external dependencies without a specific need and want to avoid bloating the classpath.

Advantages

The project is not tied to any external API and can be used with any HTTP client or framework. You can use it with any HTTP client you like:

Alternatives

If you need a real HTTP server for serving a production worload, you should definitely take a look at

About

A light and minimalistic HTTP server for Java with zero dependencies and quick startup time

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages