void stop() {
        try {
            stopping = true;

            if (socket != null) {
                socket.close();
                socket = null;
            }

            if (processFuture != null) {
                processFuture.get(5, TimeUnit.SECONDS);
            }

            serverSocket.close();

            if (executor != null) {
                executor.shutdown();
                executor.awaitTermination(5, TimeUnit.SECONDS);
                executor = null;
            }
        } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
            throw new RuntimeException(e);
        }
    }
A {@link MessageProcessor} that simply echos back the received message to the client.
benchmark-base/src/main/java/org/conscrypt/ServerEndpoint.java