code: public ServerSocket socket() throws IOException {
          final String port = this.map.get("port");
          if (port == null) {
              throw new IllegalArgumentException("--port must be specified");
          }
          final ServerSocket socket;
          if (port.matches("\\d+")) {
              socket = new ServerSocket(Integer.parseInt(port));
          } else {
              final File file = new File(port);
              if (file.exists()) {
                  try (Reader reader = new Utf8InputStreamContent(
                      Files.newInputStream(file.toPath())
                      )
                  ) {
                      // @checkstyle MagicNumber (1 line)
                      final char[] chars = new char[8];
                      final int length = reader.read(chars);
                      socket = new ServerSocket(
                          Integer.parseInt(new String(chars, 0, length))
                      );
                  }
              } else {
                  socket = new ServerSocket(0);
                  try (Writer writer = new Utf8OutputStreamContent(
                      Files.newOutputStream(file.toPath())
                  )) {
                      writer.append(Integer.toString(socket.getLocalPort()));
                  }
              }
          }
          return socket;
      }
docs: Get the socket to listen to.
  @return Socket
  @throws IOException If fails