private PublishMessage generatePublishMessage() { PublishMessage publishMessage = (PublishMessage) MessageFactory.getMessageInstance(MessageType.PUBLISH); publishMessage .setTopic(publishTopic) .setMessageId(Math.abs(new Random().nextInt())) .setPayload(new RandomSentenceGenerator().generate(new Random().nextInt(19) + 1)); return publishMessage; }
private ConnectMessage generateConnectMessage() { ConnectMessage connectMessage = (ConnectMessage) MessageFactory.getMessageInstance(MessageType.CONNECT); connectMessage.setId(Math.abs(new Random().nextInt())); return connectMessage; }