public static boolean isPortUnavailableForUdp(final int port) {
    try (final DatagramSocket datagramSocket = new DatagramSocket(null)) {
      datagramSocket.setReuseAddress(true);
      datagramSocket.bind(new InetSocketAddress(port));
      datagramSocket.close();
      return false;
    } catch (IOException ex) {
      LOG.trace(String.format("failed to open port %d for UDP", port), ex);
    }
    return true;
  }
Is port unavailable for udp.

@param port the port
@return true if the port is unavailable for UDP
util/src/main/java/org/hyperledger/besu/util/NetworkUtility.java