@Test
public void testTryWithResourcesShouldCloseAllResources() throws Exception {

  EventLoopGroup eventLoop;
  Timer timer;
  try (Server server = Server.builder().build()) {
    // Do nothing here, since this is a unit test, we don't want to create any inet sockets
    // which is what Server does by default.
    eventLoop = server.eventLoopGroup;
    timer = server.timer;
  }
  // event loop should have been closed since a custom one was not provided.
  assertThat(eventLoop.isShutdown()).isTrue();
  // timer should have since a custom one was not provided.
  try {
    timer.newTimeout(
        timeout -> {
          // noop
        },
        1,
        TimeUnit.SECONDS);
    fail("Expected IllegalStateException");
  } catch (IllegalStateException ise) {
    // expected
  }
}