public class NetworkManager extends io.netty.channel.SimpleChannelInboundHandler<Packet<?>>
Modifier and Type | Class and Description |
---|---|
(package private) static class |
NetworkManager.InboundHandlerTuplePacketListener |
Modifier and Type | Field and Description |
---|---|
private io.netty.channel.Channel |
channel |
static LazyLoadBase<io.netty.channel.epoll.EpollEventLoopGroup> |
CLIENT_EPOLL_EVENTLOOP |
static LazyLoadBase<io.netty.channel.local.LocalEventLoopGroup> |
CLIENT_LOCAL_EVENTLOOP |
static LazyLoadBase<io.netty.channel.nio.NioEventLoopGroup> |
CLIENT_NIO_EVENTLOOP |
private EnumPacketDirection |
direction |
private boolean |
disconnected |
private boolean |
isEncrypted |
private static org.apache.logging.log4j.Logger |
LOGGER |
static org.apache.logging.log4j.Marker |
NETWORK_MARKER |
static org.apache.logging.log4j.Marker |
NETWORK_PACKETS_MARKER |
private java.util.Queue<NetworkManager.InboundHandlerTuplePacketListener> |
outboundPacketsQueue |
private INetHandler |
packetListener |
static io.netty.util.AttributeKey<EnumConnectionState> |
PROTOCOL_ATTRIBUTE_KEY |
private java.util.concurrent.locks.ReentrantReadWriteLock |
readWriteLock |
private java.net.SocketAddress |
socketAddress |
private ITextComponent |
terminationReason |
Constructor and Description |
---|
NetworkManager(EnumPacketDirection packetDirection) |
Modifier and Type | Method and Description |
---|---|
io.netty.channel.Channel |
channel() |
void |
channelActive(io.netty.channel.ChannelHandlerContext p_channelActive_1_) |
void |
channelInactive(io.netty.channel.ChannelHandlerContext p_channelInactive_1_) |
protected void |
channelRead0(io.netty.channel.ChannelHandlerContext p_channelRead0_1_,
Packet<?> p_channelRead0_2_) |
void |
checkDisconnected() |
void |
closeChannel(ITextComponent message) |
static NetworkManager |
createNetworkManagerAndConnect(java.net.InetAddress address,
int serverPort,
boolean useNativeTransport) |
void |
disableAutoRead() |
private void |
dispatchPacket(Packet<?> inPacket,
io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>>[] futureListeners) |
void |
enableEncryption(javax.crypto.SecretKey key) |
void |
exceptionCaught(io.netty.channel.ChannelHandlerContext p_exceptionCaught_1_,
java.lang.Throwable p_exceptionCaught_2_) |
private void |
flushOutboundQueue() |
EnumPacketDirection |
getDirection() |
ITextComponent |
getExitMessage() |
INetHandler |
getNetHandler() |
java.net.SocketAddress |
getRemoteAddress() |
boolean |
hasNoChannel() |
boolean |
isChannelOpen() |
boolean |
isEncrypted() |
boolean |
isLocalChannel() |
void |
processReceivedPackets() |
static NetworkManager |
provideLocalClient(java.net.SocketAddress address) |
void |
sendPacket(Packet<?> packetIn) |
void |
sendPacket(Packet<?> packetIn,
io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>> listener,
io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>>... listeners) |
void |
setCompressionThreshold(int threshold) |
void |
setConnectionState(EnumConnectionState newState) |
void |
setNetHandler(INetHandler handler) |
acceptInboundMessage, channelRead
channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
private static final org.apache.logging.log4j.Logger LOGGER
public static final org.apache.logging.log4j.Marker NETWORK_MARKER
public static final org.apache.logging.log4j.Marker NETWORK_PACKETS_MARKER
public static final io.netty.util.AttributeKey<EnumConnectionState> PROTOCOL_ATTRIBUTE_KEY
public static final LazyLoadBase<io.netty.channel.nio.NioEventLoopGroup> CLIENT_NIO_EVENTLOOP
public static final LazyLoadBase<io.netty.channel.epoll.EpollEventLoopGroup> CLIENT_EPOLL_EVENTLOOP
public static final LazyLoadBase<io.netty.channel.local.LocalEventLoopGroup> CLIENT_LOCAL_EVENTLOOP
private final EnumPacketDirection direction
private final java.util.Queue<NetworkManager.InboundHandlerTuplePacketListener> outboundPacketsQueue
private final java.util.concurrent.locks.ReentrantReadWriteLock readWriteLock
private io.netty.channel.Channel channel
private java.net.SocketAddress socketAddress
private INetHandler packetListener
private ITextComponent terminationReason
private boolean isEncrypted
private boolean disconnected
public NetworkManager(EnumPacketDirection packetDirection)
public EnumPacketDirection getDirection()
public void channelActive(io.netty.channel.ChannelHandlerContext p_channelActive_1_) throws java.lang.Exception
channelActive
in interface io.netty.channel.ChannelInboundHandler
channelActive
in class io.netty.channel.ChannelInboundHandlerAdapter
java.lang.Exception
public void setConnectionState(EnumConnectionState newState)
public void channelInactive(io.netty.channel.ChannelHandlerContext p_channelInactive_1_) throws java.lang.Exception
channelInactive
in interface io.netty.channel.ChannelInboundHandler
channelInactive
in class io.netty.channel.ChannelInboundHandlerAdapter
java.lang.Exception
public void exceptionCaught(io.netty.channel.ChannelHandlerContext p_exceptionCaught_1_, java.lang.Throwable p_exceptionCaught_2_) throws java.lang.Exception
exceptionCaught
in interface io.netty.channel.ChannelHandler
exceptionCaught
in interface io.netty.channel.ChannelInboundHandler
exceptionCaught
in class io.netty.channel.ChannelInboundHandlerAdapter
java.lang.Exception
protected void channelRead0(io.netty.channel.ChannelHandlerContext p_channelRead0_1_, Packet<?> p_channelRead0_2_) throws java.lang.Exception
channelRead0
in class io.netty.channel.SimpleChannelInboundHandler<Packet<?>>
java.lang.Exception
public void setNetHandler(INetHandler handler)
public void sendPacket(Packet<?> packetIn)
public void sendPacket(Packet<?> packetIn, io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>> listener, io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>>... listeners)
private void dispatchPacket(Packet<?> inPacket, @Nullable io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super java.lang.Void>>[] futureListeners)
private void flushOutboundQueue()
public void processReceivedPackets()
public java.net.SocketAddress getRemoteAddress()
public void closeChannel(ITextComponent message)
public boolean isLocalChannel()
public static NetworkManager createNetworkManagerAndConnect(java.net.InetAddress address, int serverPort, boolean useNativeTransport)
public static NetworkManager provideLocalClient(java.net.SocketAddress address)
public void enableEncryption(javax.crypto.SecretKey key)
public boolean isEncrypted()
public boolean isChannelOpen()
public boolean hasNoChannel()
public INetHandler getNetHandler()
public ITextComponent getExitMessage()
public void disableAutoRead()
public void setCompressionThreshold(int threshold)
public void checkDisconnected()
public io.netty.channel.Channel channel()