private static int getPort(String[] args) {
    int port = 0;
    if (args != null && args.length > 0) {
      for (final String arg : args) {
        if (arg.startsWith("-port")) {
          String p = arg.substring(arg.indexOf('='));
          p = p.trim();
          port = Integer.parseInt(p);
        }
      }
    }
    return port;
  }
shuts down this server and closes the embedded GemFire caching node
geode-memcached/src/main/java/org/apache/geode/memcached/GemFireMemcachedServer.java