@Test
  public void testDeleteSubscription()
      throws IOException, JSONException, UnexpectedReplyTypeException {
    Topic topic = new Topic();
    topic.setName("testDeleteSubscription");

    TopicResponse topicResponse = client.getTopicClient().create(topic);

    assert (topicResponse.getMessage().equals("Object created"));

    Subscription subscription = new Subscription();
    Endpoint endpoint = subscription.new Endpoint();
    endpoint.setMethod(HttpMethod.get);
    endpoint.setUrl("http://www.example.com/");

    subscription.setEndpoint(endpoint);
    subscription.setSubscriptionType(EndpointType.http);

    SubscriptionResponse subscriptionResponse =
        client.getTopicClient().subscribe(topic.getName(), subscription);

    topicResponse =
        client.getTopicClient().deleteSubscription(topic.getName(), subscriptionResponse.getId());

    assert (topicResponse.getMessage().equalsIgnoreCase("Object queued for deletion"));
  }
  @Test
  public void testSubscribe() throws IOException, JSONException, UnexpectedReplyTypeException {
    Subscription sub = new Subscription();

    Endpoint end = sub.new Endpoint();

    sub.setSubscriptionType(EndpointType.http);
    end.setMethod(HttpMethod.get);
    end.setUrl("http://www.example.com/");
    Hashtable<String, String> headers = new Hashtable<String, String>();
    headers.put("Content-Type", "application/x-www-form-urlencoded");
    end.setHeaders(headers);
    end.setBody("Hello World!");

    sub.setEndpoint(end);

    Topic topic = new Topic();
    topic.setName("testSubscriptionTopic");
    TopicResponse topResponse = client.getTopicClient().create(topic);

    assert (topResponse.getMessage().equalsIgnoreCase("Object created"));

    SubscriptionResponse subResponse = client.getTopicClient().subscribe(topic.getName(), sub);

    assert (subResponse.getMessage().equalsIgnoreCase("Object created"));
  }
  @Test
  public void testGetSubscriptions()
      throws IOException, JSONException, UnexpectedReplyTypeException {
    Topic topic = new Topic();
    topic.setName("testGetSubscriptions");
    client.getTopicClient().create(topic);

    Subscription subscription = new Subscription();
    Endpoint endpoint = subscription.new Endpoint();
    endpoint.setMethod(HttpMethod.get);
    endpoint.setUrl("http://www.example.com/");

    subscription.setEndpoint(endpoint);
    subscription.setSubscriptionType(EndpointType.http);

    client.getTopicClient().subscribe(topic.getName(), subscription);

    SubscriptionResponse subResponse = client.getTopicClient().getSubscriptions(topic.getName());
    assert (subResponse.getItems().length > 0);
  }