code: public void quit() {
          try {
              this.keepOn = false;
              if (this.serverSocket != null && !this.serverSocket.isClosed()) {
                  this.serverSocket.close();
                  this.serverSocket = null;
              }
          } catch (final IOException e) {
              throw new RuntimeException(e);
          }
      }
docs: Exit POP3 server.