@Test
    void customStartStopExecutor() {
        final Queue<Thread> threads = new LinkedTransferQueue<>();
        final String prefix = getClass().getName() + "#customStartStopExecutor";

        final AtomicBoolean serverStarted = new AtomicBoolean();
        final ThreadFactory factory = ThreadFactories.builder(prefix).taskFunction(task -> () -> {
            await().untilFalse(serverStarted);
            task.run();
        }).build();

        final ExecutorService executor = Executors.newSingleThreadExecutor(factory);
        final Server server = Server.builder()
                                    .startStopExecutor(executor)
                                    .service("/", (ctx, req) -> HttpResponse.of(200))
                                    .serverListener(new ThreadRecordingServerListener(threads))
                                    .build();

        threads.add(server.start().thenApply(unused -> Thread.currentThread()).join());
        serverStarted.set(true);

        final CompletableFuture<Thread> stopFuture = server.stop().thenApply(
                unused -> Thread.currentThread());
        serverStarted.set(false);
        threads.add(stopFuture.join());

        threads.forEach(t -> assertThat(t.getName()).startsWith(prefix));
    }
Ensure that the connection is not broken even if {@link Service#serve(ServiceRequestContext, Request)}
raises an exception.
core/src/test/java/com/linecorp/armeria/server/ServerTest.java