Code review comment: Thanks for the suggestion, code also looks much cleaner using `Deadline`.

Code under review:
public static void main(String[] args) throws Exception {
		LOG.info("System properties: {}", System.getProperties());
		
		final ParameterTool parameterTool = ParameterTool.fromArgs(args);
		StreamExecutionEnvironment env = KafkaExampleUtil.prepareExecutionEnv(parameterTool);

		String inputStream = parameterTool.getRequired("input-stream");
		String outputStream = parameterTool.getRequired("output-stream");

		PubsubClient pubsub = new KinesisPubsubClient(parameterTool.getProperties());
		pubsub.createTopic(inputStream, 2, parameterTool.getProperties());
		pubsub.createTopic(outputStream, 2, parameterTool.getProperties());

		FlinkKinesisConsumer<KafkaEvent> consumer = new FlinkKinesisConsumer<>(
			inputStream,
			new KafkaEventSchema(),
			parameterTool.getProperties());
		consumer.setPeriodicWatermarkAssigner(new CustomWatermarkExtractor());

		DataStream<KafkaEvent> input = env
				.addSource(consumer)
				.keyBy("word")
				.map(new RollingAdditionMapper());

		Properties producerProperties = new Properties(parameterTool.getProperties());
		
		producerProperties.put(ConsumerConfigConstants.AWS_REGION, "us-east-1");

		
		String kinesisUrl = producerProperties.getProperty(ConsumerConfigConstants.AWS_ENDPOINT);
		if (kinesisUrl != null) {
			URL url = new URL(kinesisUrl);
			producerProperties.put("KinesisEndpoint", url.getHost());
			producerProperties.put("KinesisPort", Integer.toString(url.getPort()));
			producerProperties.put("VerifyCertificate", "false");
		}

		FlinkKinesisProducer<KafkaEvent> producer = new FlinkKinesisProducer<>(
			new KafkaEventSchema(),
			producerProperties);
		producer.setDefaultStream(outputStream);
		producer.setDefaultPartition("fakePartition");

		input.addSink(producer);

		final AtomicReference<Exception> caughtException = new AtomicReference<>();

		
		Thread executeThread =
			new Thread(
				() -> {
					try {
						env.execute();
						LOG.info("executed program");
					} catch (Exception e) {
						caughtException.set(e);
					}
				});
		executeThread.start();

		
		String[] messages = { "elephant,5,45218", "squirrel,12,46213", "bee,3,51348", "squirrel,22,52444", "bee,10,53412", "elephant,9,54867" };
		for (String msg : messages) {
			pubsub.sendMessage(inputStream, msg);
		}
		LOG.info("generated records");

		long timeoutMillis = System.currentTimeMillis() + 30_000;
		List<String> results = pubsub.readAllMessages(outputStream);
		while (System.currentTimeMillis() < timeoutMillis) {
			if (results.size() == messages.length) {
				break;
			}
			LOG.info("waiting for results..");
			Thread.sleep(1000);
			results = pubsub.readAllMessages(outputStream);
		}

		LOG.info("results: {}", results);
		if (results.size() != messages.length) {
			throw new AssertionError("Expected results were not received from " + outputStream);
		}
		

		
		
		System.out.println("test finished");
		System.exit(0);
	}

Line commented on: while (System.currentTimeMillis() < timeoutMillis) {

Revised code:
public static void main(String[] args) throws Exception {
		
		final ParameterTool parameterTool = ParameterTool.fromArgs(args);
		StreamExecutionEnvironment env = KafkaExampleUtil.prepareExecutionEnv(parameterTool);

		String inputStream = parameterTool.getRequired("input-stream");
		String outputStream = parameterTool.getRequired("output-stream");

		FlinkKinesisConsumer<KafkaEvent> consumer = new FlinkKinesisConsumer<>(
			inputStream,
			new KafkaEventSchema(),
			parameterTool.getProperties());
		consumer.setPeriodicWatermarkAssigner(new CustomWatermarkExtractor());

		Properties producerProperties = new Properties(parameterTool.getProperties());
		
		producerProperties.putIfAbsent(ConsumerConfigConstants.AWS_REGION, "us-east-1");

		
		String kinesisUrl = producerProperties.getProperty(ConsumerConfigConstants.AWS_ENDPOINT);
		if (kinesisUrl != null) {
			URL url = new URL(kinesisUrl);
			producerProperties.put("KinesisEndpoint", url.getHost());
			producerProperties.put("KinesisPort", Integer.toString(url.getPort()));
			producerProperties.put("VerifyCertificate", "false");
		}

		FlinkKinesisProducer<KafkaEvent> producer = new FlinkKinesisProducer<>(
			new KafkaEventSchema(),
			producerProperties);
		producer.setDefaultStream(outputStream);
		producer.setDefaultPartition("fakePartition");

		DataStream<KafkaEvent> input = env
			.addSource(consumer)
			.keyBy("word")
			.map(new RollingAdditionMapper());

		input.addSink(producer);
		env.execute();
	}