public static <T> Read<T> readMessage() {
    return new AutoValue_JmsIO_Read.Builder<T>()
        .setMaxNumRecords(Long.MAX_VALUE)
        .setCloseTimeout(DEFAULT_CLOSE_TIMEOUT)
        .setRequiresDeduping(false)
        .build();
  }
@Test
  public void testReadBytesMessages() throws Exception {
    long count = 1L;
    // produce message
    produceTestMessages(count, JmsIOTest::createBytesMessage);
    // read from the queue
    PCollection<String> output =
        pipeline.apply(
            JmsIO.<String>readMessage()
                .withConnectionFactory(connectionFactory)
                .withQueue(QUEUE)
                .withUsername(USERNAME)
                .withPassword(PASSWORD)
                .withMaxNumRecords(1)
                .withCoder(SerializableCoder.of(String.class))
                .withMessageMapper(new CommonJms.BytesMessageToStringMessageMapper()));

    PAssert.thatSingleton(output.apply("Count", Count.<String>globally())).isEqualTo(count);
    pipeline.run();

    assertQueueIsEmpty();
  }