public class ServerClientTest { private HttpServer server; private WebTarget target; @Before public void setUp() throws Exception { server = Main.startServer(); Client c = ClientBuilder.newClient(); target = c.target(Main.BASE_URI); } @After public void tearDown() throws Exception { server.stop(); } /** * Test to see that the message "Got it!" is sent in the response. */ @Test public void testGetIt() { String responseMsg = target.path("myresource").request().get(String.class); assertEquals("Got it!", responseMsg); } }