### Question:
RedisCallback implements Closeable { public String send(String channel, String data) throws TimeoutException { checkNotNull(channel, "channel"); checkNotNull(data, "data"); response = null; messaging.publish(channel, data); while (System.currentTimeMillis() <= timeout) { if (response != null) { return response; } try { Thread.sleep(64); } catch (InterruptedException e) { e.printStackTrace(); } } throw new TimeoutException("Timeout on response channel " + listening); } RedisCallback(RedisMessaging redis, String listen, long timeout, TimeUnit timeUnit);  RedisCallback(RedisMessaging messaging, String listen); String send(String channel, String data); @Override void close();  }### Answer:
@Test public void test() throws Exception { try (RedisCallback callback = new RedisCallback(messaging, listen)) { Thread.sleep(250); String response = callback.send(listen, string); Assert.assertEquals(string, response); } catch (JedisConnectionException error) { thread.interrupt(); Assume.assumeTrue(false); } }