Class AprSocketContext


  • public class AprSocketContext
    extends Object
    • Field Detail

      • running

        protected boolean running
      • sslMode

        protected boolean sslMode
    • Constructor Detail

      • AprSocketContext

        public AprSocketContext()
    • Method Detail

      • setPollerThreadCount

        public void setPollerThreadCount​(int pollerThreadCount)
      • getPollerThreadCount

        public int getPollerThreadCount()
      • setMaxconnections

        public void setMaxconnections​(int maxCon)
      • setBacklog

        public void setBacklog​(int backlog)
      • getBacklog

        public int getBacklog()
      • setDeferAccept

        public void setDeferAccept​(boolean deferAccept)
        Defer accept.
      • getDeferAccept

        public boolean getDeferAccept()
      • setNpn

        public void setNpn​(String npn)
        For client: - ClientHello will include the npn extension ( the ID == 0x3374) - if ServerHello includes a list of protocols - select one - send it after ChangeCipherSpec and before Finish For server: - if ClientHello includes the npn extension -- will send this string as list of supported protocols in ServerHello - read the selection before Finish.
        Parameters:
        npn -
      • setNpn

        public void setNpn​(byte[] data)
      • isServer

        public boolean isServer()
      • getExecutor

        protected Executor getExecutor()
      • setTls

        public AprSocketContext setTls()
        All accepted/connected sockets will start handshake automatically.
      • setTcpNoDelay

        public void setTcpNoDelay​(boolean b)
      • setSslProtocol

        public void setSslProtocol​(String protocol)
      • setTicketKey

        public void setTicketKey​(byte[] key48Bytes)
      • getSSLCipherSuite

        public String getSSLCipherSuite()
      • setSSLCipherSuite

        public void setSSLCipherSuite​(String SSLCipherSuite)
      • getHostInfo

        public HostInfo getHostInfo​(String host,
                                    int port,
                                    boolean ssl)
        Override or use hostInfoLoader to implement persistent/memcache storage.
      • rawData

        protected void rawData​(AprSocket ch,
                               boolean inp,
                               byte[] data,
                               int pos,
                               int len,
                               int requested,
                               boolean closed)
      • socket

        public AprSocket socket​(String host,
                                int port,
                                boolean ssl)
        Get a socket for connectiong to host:port.
      • socket

        public AprSocket socket​(long socket)
      • finalize

        protected void finalize()
                         throws Throwable
        To clean the pools - we could track if all channels are closed, but this seems simpler and safer.
        Overrides:
        finalize in class Object
        Throws:
        Throwable
      • stop

        public void stop()
      • onSocket

        protected void onSocket​(AprSocket s)
        Called on each accepted socket (for servers) or after connection (client) after handshake.
      • allocatePoller

        protected long allocatePoller​(int size,
                                      long pool)