public static Message buildHandshake(String nodeId) {
    Handshake handshake = Handshake.newBuilder().setNodeId(nodeId).build();
    return Message.newBuilder().setType(MessageType.HANDSHAKE)
                               .setHandshake(handshake)
                               .build();
  }
public static Message buildHandshake ( String nodeId ) { Handshake handshake = Handshake . newBuilder ( ) . setNodeId ( nodeId ) . build ( ) ; return Message . newBuilder ( ) . setType ( MessageType . HANDSHAKE ) . setHandshake ( handshake ) . build ( ) ; }
Creates a HANDSHAKE message.

@param nodeId the node ID in the handshake message.
@return a protobuf message.