Firefly v4.0.21 is released

25 Feb 2017, Alvin Qiu

Firefly adds a brand new functional style fluent API to help you to build a complex network application and clean up a log of deprecated codes. Firefly 4.0.21 is now JDK8 only.

Here is an example to show how to build HTTP server and client using fluent API.

public class HelloHTTPServerAndClient {
    public static void main(String[] args) {
        Phaser phaser = new Phaser(2);

        HTTP2ServerBuilder httpServer = $.httpServer();
        httpServer.router().get("/").handler(ctx -> ctx.write("hello world! ").next())
                  .router().get("/").handler(ctx -> ctx.end("end message"))
                  .listen("localhost", 8080);

        $.httpClient().get("http://localhost:8080/").submit()
         .thenAccept(res -> System.out.println(res.getStringBody()))
         .thenAccept(res -> phaser.arrive());

        phaser.arriveAndAwaitAdvance();
        httpServer.stop();
        $.httpClient().stop();
    }
}

More examples, please refer to the full document.

Firefly 4.0.21 adds many new features, like this:

  • HTTP tunnel.
  • Complete redesign of functional style fluent API for HTTP server and client, TCP server and client.
  • A powerful HTTP router.
  • Using Boring SSL engine instead of JDK SSL engine.
  • Mustache template adapter.
  • Add the max log file size limit.
  • Fix some bugs.