ConnectionFactory factory = new ConnectionFactory();
factory.setUri(uri);
Connection connection = factory.newConnection();
final Channel ch = connection.createChannel();
ch.queueDeclare(SERVER_QUEUE, false, true, false, null);
ch.basicConsume(SERVER_QUEUE, true, new DefaultConsumer(ch) {
@Override
public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
String replyTo = properties.getReplyTo();
ch.basicPublish("", replyTo, MessageProperties.MINIMAL_BASIC, "Hello client!".getBytes());
}