Package mireka.pop

Class SessionThread

  • All Implemented Interfaces:
    Runnable

    public class SessionThread
    extends Thread
    SessionThread manages the TCP connection to the POP3 client and contains the loop which processes the incoming commands.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.lang.Thread

        Thread.State, Thread.UncaughtExceptionHandler
    • Field Summary

      • Fields inherited from class java.lang.Thread

        MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
    • Constructor Summary

      Constructors 
      Constructor Description
      SessionThread​(PopServer server, mireka.pop.ServerThread serverThread, java.net.Socket socket)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.OutputStream getOutputStream()  
      java.net.Socket getSocket()
      Returns the current socket.
      void quit()
      Triggers the shutdown of the thread and the closing of the connection.
      void run()  
      void sendResponse​(String response)
      Sends the response to the client
      void setSocket​(java.net.Socket socket)
      Initializes our reader, writer, and the i/o filter chains based on the specified socket.
      void shutdown()  
      • Methods inherited from class java.lang.Thread

        activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • SessionThread

        public SessionThread​(PopServer server,
                             mireka.pop.ServerThread serverThread,
                             java.net.Socket socket)
                      throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface Runnable
        Overrides:
        run in class Thread
      • sendResponse

        public void sendResponse​(String response)
                          throws java.io.IOException
        Sends the response to the client
        Throws:
        java.io.IOException
      • getOutputStream

        public java.io.OutputStream getOutputStream()
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • shutdown

        public void shutdown()
      • quit

        public void quit()
        Triggers the shutdown of the thread and the closing of the connection.
      • getSocket

        public java.net.Socket getSocket()
        Returns the current socket. This function is called when the original socket is to be wrapped by an SSLSocket, after the STLS command is received.
      • setSocket

        public void setSocket​(java.net.Socket socket)
                       throws java.io.IOException
        Initializes our reader, writer, and the i/o filter chains based on the specified socket. This is called internally when we startup and when (if) SSL is started.
        Throws:
        java.io.IOException