Package naga

Class SSLPacketHandler

    • Constructor Detail

      • SSLPacketHandler

        public SSLPacketHandler​(javax.net.ssl.SSLEngine engine,
                                NIOSocket socket,
                                naga.SSLSocketChannelResponder responder)
    • Method Detail

      • setReader

        public void setReader​(PacketReader reader)
      • setWriter

        public void setWriter​(PacketWriter writer)
      • nextPacket

        public byte[] nextPacket​(java.nio.ByteBuffer byteBuffer)
                          throws ProtocolViolationException
        Description copied from interface: PacketReader
        Create a new packet using the ByteBuffer given.

        If there isn't sufficient data to construct a packet, return null.

        Specified by:
        nextPacket in interface PacketReader
        Parameters:
        byteBuffer - the byte buffer to use.
        Returns:
        the new packet created, or null if no packet could be created. The method will continously be called until nextPacket returns null.
        Throws:
        ProtocolViolationException - is there was an error constructing the packet.
      • write

        public java.nio.ByteBuffer[] write​(java.nio.ByteBuffer[] byteBuffers)
        Description copied from interface: PacketWriter
        Convert the incoming bytes to the bytes to be serialized.
        Specified by:
        write in interface PacketWriter
        Parameters:
        byteBuffers - an array of ByteBuffers containing data the bytes to be written.
        Returns:
        the resulting array of ByteBuffers.
      • getSSLEngine

        public javax.net.ssl.SSLEngine getSSLEngine()
      • closeEngine

        public void closeEngine()
      • isEncrypted

        public boolean isEncrypted()