code: public synchronized void stop() {
          // set running to 'false' early, so that new
          // I/O operations and timeouts are rejected
          // not checking the value of 'running'
          // allows 'stop' to be called multiple times,
          // AFAIK, this is not an issue and are noops
          running = false;
  
          LOGGER.info("{}: stopping network client", self.getId());
  
          if (serverChannel != null) {
              serverChannel.disconnect().awaitUninterruptibly();
          }
  
          if (server != null) {
              server.shutdown();
          }
  
          clusterChannelGroup.disconnect().awaitUninterruptibly();
  
          if (client != null) {
              client.shutdown();
          }
      }
docs: Stop the {@code RaftNetworkClient}.
  <p/>
  When a call to {@code stop()} is made
  all existing incoming and outgoing connections
  are disconnected and closed. The server component
  will stop accepting incoming connections and the
  client component will not initiate any connections
  to other Raft servers. Pending reconnect timeouts
  will fail silently. Since these timeouts may yet
  run in the future callers <strong>cannot</strong>
  assume exclusive access to system resources immediately
  following {@code stop()}.
  <p/>
  The network thread pools <strong>are not</strong>
  terminated. It is the caller's responsibility to call
  {@link ChannelFactory#releaseExternalResources()} on
  {@code serverChannelFactory} and {@code clientChannelFactory}
  to terminate them.
  <p/>
  Following a successful call to {@code stop()} subsequent calls are noops.