JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("org.apache.cxf.http.throw_io_exceptions", Boolean.TRUE);
bean.setProperties(properties);
bean.setAddress("http://localhost:9092/test/services/rest/bookstore/356");
WebClient wc = bean.createWebClient();
Response response = wc.get();
assertEquals(404, response.getStatus());
String msg = IOUtils.readStringFromStream((InputStream)response.getEntity());
assertEquals("No Book with id 356 is available", msg);