Class NettyClientServerCommunicationSystemClientSide
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.channel.SimpleChannelInboundHandler<TOMMessage>
-
- bftsmart.communication.client.netty.NettyClientServerCommunicationSystemClientSide
-
- All Implemented Interfaces:
CommunicationSystemClientSide
,io.netty.channel.ChannelHandler
,io.netty.channel.ChannelInboundHandler
@Sharable public class NettyClientServerCommunicationSystemClientSide extends io.netty.channel.SimpleChannelInboundHandler<TOMMessage> implements CommunicationSystemClientSide
-
-
Field Summary
Fields Modifier and Type Field Description protected ReplyReceiver
trr
-
Constructor Summary
Constructors Constructor Description NettyClientServerCommunicationSystemClientSide(int clientId, ClientViewController controller)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
channelActive(io.netty.channel.ChannelHandlerContext ctx)
void
channelInactive(io.netty.channel.ChannelHandlerContext ctx)
void
channelRead0(io.netty.channel.ChannelHandlerContext ctx, TOMMessage sm)
void
channelUnregistered(io.netty.channel.ChannelHandlerContext ctx)
void
close()
io.netty.channel.ChannelFuture
connectToReplica(int replicaId, javax.crypto.SecretKeyFactory fac)
Tulio Ribeiro Connect to specific replica and returns the ChannelFuture.void
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, java.lang.Throwable cause)
void
reconnect(io.netty.channel.ChannelHandlerContext ctx)
void
removeClient(int clientId)
void
send(boolean sign, int[] targets, TOMMessage sm)
void
setReplyReceiver(ReplyReceiver trr)
void
sign(TOMMessage sm)
byte[]
signMessage(java.security.PrivateKey key, byte[] message)
void
updateConnections()
-
Methods inherited from class io.netty.channel.SimpleChannelInboundHandler
acceptInboundMessage, channelRead
-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelReadComplete, channelRegistered, channelWritabilityChanged, userEventTriggered
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
-
-
-
-
Field Detail
-
trr
protected ReplyReceiver trr
-
-
Constructor Detail
-
NettyClientServerCommunicationSystemClientSide
public NettyClientServerCommunicationSystemClientSide(int clientId, ClientViewController controller)
-
-
Method Detail
-
updateConnections
public void updateConnections()
- Specified by:
updateConnections
in interfaceCommunicationSystemClientSide
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, java.lang.Throwable cause) throws java.lang.Exception
- Specified by:
exceptionCaught
in interfaceio.netty.channel.ChannelHandler
- Specified by:
exceptionCaught
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
exceptionCaught
in classio.netty.channel.ChannelInboundHandlerAdapter
- Throws:
java.lang.Exception
-
channelRead0
public void channelRead0(io.netty.channel.ChannelHandlerContext ctx, TOMMessage sm) throws java.lang.Exception
- Specified by:
channelRead0
in classio.netty.channel.SimpleChannelInboundHandler<TOMMessage>
- Throws:
java.lang.Exception
-
channelActive
public void channelActive(io.netty.channel.ChannelHandlerContext ctx)
- Specified by:
channelActive
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelActive
in classio.netty.channel.ChannelInboundHandlerAdapter
-
reconnect
public void reconnect(io.netty.channel.ChannelHandlerContext ctx)
-
setReplyReceiver
public void setReplyReceiver(ReplyReceiver trr)
- Specified by:
setReplyReceiver
in interfaceCommunicationSystemClientSide
-
send
public void send(boolean sign, int[] targets, TOMMessage sm)
- Specified by:
send
in interfaceCommunicationSystemClientSide
-
sign
public void sign(TOMMessage sm)
- Specified by:
sign
in interfaceCommunicationSystemClientSide
-
signMessage
public byte[] signMessage(java.security.PrivateKey key, byte[] message)
-
close
public void close()
- Specified by:
close
in interfaceCommunicationSystemClientSide
-
channelUnregistered
public void channelUnregistered(io.netty.channel.ChannelHandlerContext ctx) throws java.lang.Exception
- Specified by:
channelUnregistered
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelUnregistered
in classio.netty.channel.ChannelInboundHandlerAdapter
- Throws:
java.lang.Exception
-
channelInactive
public void channelInactive(io.netty.channel.ChannelHandlerContext ctx)
- Specified by:
channelInactive
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelInactive
in classio.netty.channel.ChannelInboundHandlerAdapter
-
connectToReplica
public io.netty.channel.ChannelFuture connectToReplica(int replicaId, javax.crypto.SecretKeyFactory fac) throws java.security.NoSuchAlgorithmException, java.security.spec.InvalidKeySpecException, java.security.InvalidKeyException
Tulio Ribeiro Connect to specific replica and returns the ChannelFuture. sessionClientToReplica is replaced with the new connection. Removed redundant code.- Throws:
java.security.NoSuchAlgorithmException
java.security.spec.InvalidKeySpecException
java.security.InvalidKeyException
-
removeClient
public void removeClient(int clientId)
-
-