- public static void service(Socket s) throws IOException {
- BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream()));
- PrintWriter pw = new PrintWriter(new OutputStreamWriter(s.getOutputStream()));
- pw.print("+OK POP3 server ready\r\n");
- pw.flush();
- String user = null;
- String pass = null;
- while(true) {
- String command = br.readLine().trim();
- System.out.println("command: " + command);
- if (command.toUpperCase().startsWith("QUIT ")) {
- s.close();
- return;
- } else if (command.toUpperCase().startsWith("USER ")) {
- user = command.substring(5).trim();
- pw.print("+OK now give me your password\r\n");
- pw.flush();
- } else if (command.toUpperCase().startsWith("PASS ")) {
- if (user == null) {
- pw.print("-ERR I need your password first\r\n");
+ public static void service(Socket s) throws IOException {
+ BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream()));
+ PrintWriter pw = new PrintWriter(new OutputStreamWriter(s.getOutputStream()));
+ pw.print("+OK POP3 server ready\r\n");
+ pw.flush();
+ String user = null;
+ String pass = null;
+ while(true) {
+ String command = br.readLine().trim();
+ System.out.println("command: " + command);
+ if (command.toUpperCase().startsWith("QUIT ")) {
+ s.close();
+ return;
+ } else if (command.toUpperCase().startsWith("USER ")) {
+ user = command.substring(5).trim();
+ pw.print("+OK now give me your password\r\n");