Class NettyNetworkClientHandler

java.lang.Object
io.netty5.channel.SimpleChannelInboundHandler<eu.cloudnetservice.driver.network.protocol.BasePacket>
eu.cloudnetservice.driver.impl.network.netty.NettyNetworkHandler
eu.cloudnetservice.driver.impl.network.netty.client.NettyNetworkClientHandler
All Implemented Interfaces:
io.netty5.channel.ChannelHandler

public class NettyNetworkClientHandler extends NettyNetworkHandler
Constructs a default implementation for a client network handler, delegating most of the calls to the network client.
Since:
4.0
  • Field Details

    • connectedAddress

      private final eu.cloudnetservice.driver.network.HostAndPort connectedAddress
    • nettyNetworkClient

      private final NettyNetworkClient nettyNetworkClient
  • Constructor Details

    • NettyNetworkClientHandler

      public NettyNetworkClientHandler(@NonNull @NonNull NettyNetworkClient nettyNetworkClient, @NonNull @NonNull eu.cloudnetservice.driver.network.HostAndPort connectedAddress)
      Constructs a new network client handler instance.
      Parameters:
      nettyNetworkClient - the client which connected to the endpoint.
      connectedAddress - the server address to which the client connected.
      Throws:
      NullPointerException - if either the given event manager, client or connect address is null.
  • Method Details

    • channelActive

      public void channelActive(@NonNull @NonNull io.netty5.channel.ChannelHandlerContext ctx) throws Exception
      Throws:
      Exception
    • channels

      @NonNull protected @NonNull Collection<eu.cloudnetservice.driver.network.NetworkChannel> channels()
      Get all channels which are connected to the underlying network component.
      Specified by:
      channels in class NettyNetworkHandler
      Returns:
      all connected channels.
    • packetDispatcher

      @NonNull protected @NonNull Executor packetDispatcher()
      Get the packet dispatcher used to dispatch incoming packets. Each dispatcher is normally bound to the network component which opened/received the connection and requested this handler.
      Specified by:
      packetDispatcher in class NettyNetworkHandler
      Returns:
      the dispatcher used to dispatch packets.