Class BenchmarkApnsServer

java.lang.Object
com.eatthepath.pushy.apns.server.BenchmarkApnsServer

public class BenchmarkApnsServer extends Object
A simple HTTP/2 server designed to crudely emulate the behavior of a real APNs server as simply and quickly as possible. Benchmark servers always accept notifications, regardless of whether they are legal or well-formed, and always include the same apns-id header for any given connection. These behaviors minimize the processing time consumed by the server, reducing the chances that benchmarks are measuring the performance of the mock server instead of the performance of the client.
Since:
0.13.0
  • Method Details

    • start

      public CompletableFuture<Integer> start(int port)
      Starts this mock server and listens for traffic on the given port.
      Parameters:
      port - the port to which this server should bind; callers may pass 0 to bind to the first available port
      Returns:
      a future that returns the bound port when the server has started and is ready to accept traffic
    • shutdown

      public CompletableFuture<Void> shutdown()

      Shuts down this server and releases the port to which this server was bound. If a null event loop group was provided at construction time, the server will also shut down its internally-managed event loop group.

      If a non-null EventLoopGroup was provided at construction time, mock servers may be reconnected and reused after they have been shut down. If no event loop group was provided at construction time, mock servers may not be restarted after they have been shut down via this method.

      Returns:
      a Future that will succeed once the server has finished unbinding from its port and, if the server was managing its own event loop group, its event loop group has shut down