code: private static int port(final File file) throws Exception {
          while (!file.exists()) {
              TimeUnit.MILLISECONDS.sleep(1L);
          }
          final int port;
          try (InputStream input = Files.newInputStream(file.toPath())) {
              // @checkstyle MagicNumber (1 line)
              final byte[] buf = new byte[10];
              while (true) {
                  if (input.read(buf) > 0) {
                      break;
                  }
              }
              port = Integer.parseInt(
                  new TrimmedText(new Utf8String(buf)).asString()
              );
          }
          return port;
      }
docs: Read port number from file.
  @param file The file
  @return Port number
  @throws Exception If fails