private void startMemcachedServer() throws IOException, InterruptedException {
    ServerSocketChannel channel = ServerSocketChannel.open();
    final ServerSocket serverSocket = channel.socket();
    serverSocket.setReceiveBufferSize(getSocketBufferSize());
    serverSocket.setReuseAddress(true);
    serverSocket.bind(new InetSocketAddress(getBindAddress(), serverPort));
    if (logger.fineEnabled()) {
      logger.fine("GemFireMemcachedServer configured socket buffer size:" + getSocketBufferSize());
    }
    final CountDownLatch latch = new CountDownLatch(1);
    acceptor = new Thread(() -> {
      for (;;) {
        Socket s = null;
        try {
          latch.countDown();
          s = serverSocket.accept();
          s.setKeepAlive(SocketCreator.ENABLE_TCP_KEEP_ALIVE);
          handleNewClient(s);
        } catch (ClosedByInterruptException e) {
          try {
            serverSocket.close();
          } catch (IOException e1) {
            e1.printStackTrace();
          }
          break;
        } catch (IOException e) {
          e.printStackTrace();
          break;
        }
      }
    }, "AcceptorThread");
    acceptor.setDaemon(true);
    acceptor.start();
    latch.await();
    logger.config("GemFireMemcachedServer server started on host:" + LocalHostUtil.getLocalHost()
        + " port: " + serverPort);
  }
Starts an embedded GemFire caching node, and then listens for new memcached client connections.
geode-memcached/src/main/java/org/apache/geode/memcached/GemFireMemcachedServer.java