use of net.servicestack.client.ConnectionFilter in project ServiceStack.Java by ServiceStack.
the class TestServiceTestsAsync method test_Can_delete_ReturnVoid_Async.
public void test_Can_delete_ReturnVoid_Async() {
final CountDownLatch signal = new CountDownLatch(1);
final List<String> sentMethods = new ArrayList<>();
client.RequestFilter = new ConnectionFilter() {
@Override
public void exec(HttpURLConnection conn) {
sentMethods.add(conn.getRequestMethod());
}
};
client.deleteAsync(new HelloReturnVoid().setId(1), new AsyncResultVoid() {
@Override
public void success() {
assertEquals(HttpMethods.Delete, sentMethods.get(sentMethods.size() - 1));
signal.countDown();
}
});
}
use of net.servicestack.client.ConnectionFilter in project ServiceStack.Java by ServiceStack.
the class JsonServiceClientTests method test_can_use_request_filter.
public void test_can_use_request_filter() {
final Boolean[] passTest = { false };
JsonServiceClient localTestClient = new JsonServiceClient("http://test.servicestack.net/");
localTestClient.RequestFilter = new ConnectionFilter() {
@Override
public void exec(HttpURLConnection conn) {
passTest[0] = true;
}
};
Hello request = new Hello().setName("World");
HelloResponse response = localTestClient.get(request);
assertEquals("Hello, World!", response.getResult());
assertTrue(passTest[0]);
}
Aggregations