@Test
    void testShortShutdownGracePeriod() {

        withServer(ofMillis(2000), (service, lifecycle) -> {
            // Start server
            lifecycle.start();

            // Send first request (Takes 1s)
            service.nextDelay(ofMillis(1000));
            final Future<SomeType> request1 = stub.normal(EMPTY);

            // Send second request (Takes 5s)
            service.nextDelay(ofMillis(5000));
            final Future<SomeType> request2 = stub.normal(EMPTY);

            // Send last request (Takes 1s)
            service.nextDelay(ofMillis(1000));
            final Future<SomeType> request3 = stub.normal(EMPTY);

            service.awaitAllRequestsArrived();

            // Shutdown and wait a short amount of time to shutdown gracefully
            assertTimeoutPreemptively(ofMillis(2000 + A_BIT_TIME), (Executable) lifecycle::stop);

            // First one completed
            assertCompleted(request1);

            // The second one did not complete in time
            assertFailedShutdown(request2);

            // Last one completed
            assertCompleted(request3);
        });
    }
Tests for {@link GrpcServerLifecycle}'s shutdown behavior using an in-process server/channel.
tests/src/test/java/net/devh/boot/grpc/test/shutdown/GrpcServerLifecycleWithCallsTest.java