View Javadoc

1   /*
2    * Copyright (c) 2004-2007 Creative Sphere Limited.
3    * All rights reserved. This program and the accompanying materials
4    * are made available under the terms of the Eclipse Public License v1.0
5    * which accompanies this distribution, and is available at
6    * http://www.eclipse.org/legal/epl-v10.html
7    *
8    * Contributors:
9    *
10   *   Creative Sphere - initial API and implementation
11   *
12   */
13  package org.abstracthorizon.mercury.smtp.command;
14  
15  import java.io.IOException;
16  
17  import org.abstracthorizon.mercury.common.command.CommandException;
18  import org.abstracthorizon.mercury.smtp.SMTPResponses;
19  import org.abstracthorizon.mercury.smtp.SMTPSession;
20  import org.abstracthorizon.mercury.smtp.exception.ParserException;
21  
22  /**
23   * QUIT command
24   *
25   * @author Daniel Sendula
26   */
27  public class QuitCommand extends SMTPCommand {
28  
29      /**
30       * Constructor
31       */
32      public QuitCommand() {
33          super();
34      }
35  
36      /**
37       * Executed the command
38       * @param connection smtp session
39       * @throws CommandException
40       * @throws IOException
41       * @throws ParserException
42       */
43      protected void execute(SMTPSession connection) throws CommandException, IOException, ParserException {
44          connection.getScanner().check_eol();
45          connection.sendResponse(SMTPResponses.QUIT_RESPONSE);
46          connection.close();
47      }
48  }