Class 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 Detail

      • start

        public Future<Void> 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
        Returns:
        a Future that will succeed when the server has bound to the given port and is ready to accept traffic
      • shutdown

        public Future<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