code: public static void isSocketBindable(InetSocketAddress addr)
        throws IOException {
      if (addr == null) {
        return;
      }
      ServerSocket socket = new ServerSocket();
      try {
        socket.bind(addr);
      } finally {
        socket.close();
      }
    }
docs: Tries to bind to the given address. Throws an exception on failure.
  Used to fail earlier and verify configuration values.