@Test
    void testShortShutdownGracePeriod() {

        final AtomicReference<Future<SomeType>> request1 = new AtomicReference<>();
        final AtomicReference<Future<SomeType>> request2 = new AtomicReference<>();
        final AtomicReference<Future<SomeType>> request3 = new AtomicReference<>();

        assertTimeout(ofMillis(2000 + A_BIT_TIME),
                runWithStub(ofMillis(2000), stub -> {

                    // Send first request (Takes 1s)
                    service.nextDelay(ofMillis(1000));
                    request1.set(stub.normal(EMPTY));

                    // Send second request (Takes 5s)
                    service.nextDelay(ofMillis(5000));
                    request2.set(stub.normal(EMPTY));

                    // Send last request (Takes 1s)
                    service.nextDelay(ofMillis(1000));
                    request3.set(stub.normal(EMPTY));

                    service.awaitAllRequestsArrived();

                }));

        // First one completed
        assertCompleted(request1);

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

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