/**
   * Only execution point for this application.
   *
   * @param ignored not used.
   * @throws Exception if something goes wrong.
   */
  @Test
  public void test() {
    HornetQConnectionFactory hornetQConnectionFactory = null;
    Connection connection = null;
    Session session = null;

    try {
      hornetQConnectionFactory =
          new HornetQConnectionFactory(
              false, new TransportConfiguration(NettyConnectorFactory.class.getName()));
      connection = hornetQConnectionFactory.createConnection();
      connection.start();

      session = connection.createSession(false, DeliveryMode.NON_PERSISTENT);
      final MessageProducer producer = session.createProducer(new HornetQQueue(QUEUE_NAME));
      producer.send(session.createTextMessage("Hello World!"));
      System.out.println("Message sent. Please see server console output");
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      ClientUtil.closeSession(session);
      ClientUtil.closeConnection(connection);
      ClientUtil.closeConnectionFactory(hornetQConnectionFactory);
    }
  }
 protected T get(URI uri) {
   ClientResponse response =
       ClientUtil.readEntity(
           uri, getHttpClient(), getResourceRepresentationType(), ClientResponse.class);
   if (logger.isDebugEnabled()) {
     logger.debug("Request Accept header: " + getResourceRepresentationType());
     logger.debug("Response header: " + response.getType());
   }
   final int status = response.getStatus();
   if (followRedirectionEnabled
       && status == ClientResponse.Status.MOVED_PERMANENTLY.getStatusCode()) {
     final URI location = response.getLocation();
     if (location != null) {
       this.thisResourceUri = location;
       this.absoluteThisResourceUri = generateAbsoluteUri();
       return get();
     }
   }
   if (followRedirectionEnabled
       && (status == ClientResponse.Status.FOUND.getStatusCode()
           || status == ClientResponse.Status.SEE_OTHER.getStatusCode())) {
     final URI location = response.getLocation();
     if (location != null) {
       URI absolutionLocation = getHttpClient().getAbsoluteUri(location, getReferrerUri());
       return get(absolutionLocation);
     }
   }
   if (status < 300 || (status == ClientResponse.Status.NOT_MODIFIED.getStatusCode())) {
     if (response.hasEntity()
         && response.getStatus() != ClientResponse.Status.NO_CONTENT.getStatusCode()) {
       lastReadStateOfEntity = response.getEntity(getEntityClass());
       if (getClientUtil() != null) {
         try {
           getClientUtil().parseLinks(lastReadStateOfEntity, getRelatedResourceUris());
         } catch (Exception ex) {
           logger.warn(ex.getMessage(), ex);
         }
       }
       if (invokeGet) {
         invokeGETOnNestedResources();
       }
     } else {
       lastReadStateOfEntity = null;
     }
     getInvocationCount++;
     Map<String, Object> headers = new HashMap<String, Object>();
     EntityTag tag = response.getEntityTag();
     if (tag != null) {
       headers.put(HttpHeaders.ETAG, tag);
     }
     Date date = response.getLastModified();
     if (date != null) {
       headers.put(HttpHeaders.LAST_MODIFIED, date);
     }
     cachedHeaders.put(uri.toString(), headers);
     return lastReadStateOfEntity;
   }
   throw new UniformInterfaceException(response);
 }