}
private Connection connection(final CountDownLatch latch) throws IOException {
ConnectionFactory factory = new ConnectionFactory();
Connection connection = factory.newConnection();
connection.addBlockedListener(new BlockedListener() {
public void handleBlocked(String reason) throws IOException {
try {
unblock();
} catch (InterruptedException e) {
e.printStackTrace();