@Override
public void channelConnected(ChannelHandlerContext ctx,
ChannelStateEvent e) throws Exception {
channelState = ChannelState.CONNECTED;
HelloMessage m = new HelloMessage();
if (getLocalNodeId() != null)
m.setNodeId(getLocalNodeId());
AsyncMessageHeader header = new AsyncMessageHeader();
header.setTransactionId(getTransactionId());
m.setHeader(header);
switch (getAuthScheme()) {
case NO_AUTH:
channelState = ChannelState.AUTHENTICATED;
m.setAuthScheme(org.sdnplatform.sync.thrift.
AuthScheme.NO_AUTH);
break;
case CHALLENGE_RESPONSE:
AuthChallengeResponse cr = new AuthChallengeResponse();
cr.setChallenge(generateChallenge());
m.setAuthScheme(org.sdnplatform.sync.thrift.
AuthScheme.CHALLENGE_RESPONSE);
m.setAuthChallengeResponse(cr);
break;
}
SyncMessage bsm = new SyncMessage(MessageType.HELLO);
bsm.setHello(m);
ctx.getChannel().write(bsm);