Class ClientHandler

  • Direct Known Subclasses:
    ProxyStateClientHandler, SimpleClientHandler


    public abstract class ClientHandler
    extends io.netty.channel.SimpleChannelInboundHandler<io.netty.channel.socket.DatagramPacket>
    ChannelInboundHandler used by RadiusClient
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

        io.netty.channel.ChannelHandler.Sharable
    • Constructor Summary

      Constructors 
      Constructor Description
      ClientHandler​()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected void channelRead0​(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.socket.DatagramPacket datagramPacket)  
      protected abstract void handleResponse​(io.netty.channel.socket.DatagramPacket datagramPacket)
      Processes DatagramPacket.
      abstract io.netty.channel.socket.DatagramPacket prepareDatagram​(RadiusPacket original, RadiusEndpoint endpoint, java.net.InetSocketAddress sender, io.netty.util.concurrent.Promise<RadiusPacket> promise)
      Preprocess RadiusPackets before they are sent.
      • Methods inherited from interface io.netty.channel.ChannelHandler

        handlerAdded, handlerRemoved
      • Methods inherited from class io.netty.channel.ChannelHandlerAdapter

        ensureNotSharable, handlerAdded, handlerRemoved, isSharable
      • Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

        channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from class io.netty.channel.SimpleChannelInboundHandler

        acceptInboundMessage, channelRead
    • Constructor Detail

      • ClientHandler

        public ClientHandler​()
    • Method Detail

      • prepareDatagram

        public abstract io.netty.channel.socket.DatagramPacket prepareDatagram​(RadiusPacket original,
                                                                               RadiusEndpoint endpoint,
                                                                               java.net.InetSocketAddress sender,
                                                                               io.netty.util.concurrent.Promise<RadiusPacket> promise)
                                                                        throws RadiusException
        Preprocess RadiusPackets before they are sent. May mutate outbound packets.

        Save state info about outgoing requests so handler has context when handling replies

        Ensure that you also return the encoded packet, typically with the shared secret available in RadiusEndpoint.

        Parameters:
        original - request to send
        endpoint - packet endpoint
        sender - outbound socket for datagram
        promise - promise placeholder that represents overarching request (including retries)
        Returns:
        promise of response which completes when server responds. Uses Promise instead Future, to allow requests to be timed out or cancelled by the caller
        Throws:
        RadiusException - if packet could not be encoded/serialized to datagram
      • handleResponse

        protected abstract void handleResponse​(io.netty.channel.socket.DatagramPacket datagramPacket)
                                        throws RadiusException
        Processes DatagramPacket. This does not swallow exceptions.
        Parameters:
        datagramPacket - datagram received
        Throws:
        RadiusException - malformed packet
      • channelRead0

        protected void channelRead0​(io.netty.channel.ChannelHandlerContext ctx,
                                    io.netty.channel.socket.DatagramPacket datagramPacket)
        Specified by:
        channelRead0 in class io.netty.channel.SimpleChannelInboundHandler<io.netty.channel.socket.DatagramPacket>