@Test public void testGet() throws Exception { final String greet = "Hello World"; HttpDaemon.registerServlet("/", new HttpServlet() { @Override public HttpResponse doGet(HttpRequest request) { return HttpResponse.newResponse(greet); } @Override public HttpResponse doPost(HttpRequest request) { return null; } }); Request request = new Request.Builder().url(url).build(); Response response = new OkHttpClient().newCall(request).execute(); assertThat(response.body().string(), is(greet)); }
public static void registerServlet(String urlPattern, HttpServlet servlet) { sServletMap.put(urlPattern, servlet); }
HttpDaemon { public static void registerServlet(String urlPattern, HttpServlet servlet) { sServletMap.put(urlPattern, servlet); } }
HttpDaemon { public static void registerServlet(String urlPattern, HttpServlet servlet) { sServletMap.put(urlPattern, servlet); } HttpDaemon(int port);  HttpDaemon(); }
HttpDaemon { public static void registerServlet(String urlPattern, HttpServlet servlet) { sServletMap.put(urlPattern, servlet); } HttpDaemon(int port);  HttpDaemon(); static void registerServlet(String urlPattern, HttpServlet servlet); static int getPort(); static HttpDaemon getSingleton(); void start(); void stop(); boolean isAlive(); boolean isStarted(); int aliveRequests(); }
HttpDaemon { public static void registerServlet(String urlPattern, HttpServlet servlet) { sServletMap.put(urlPattern, servlet); } HttpDaemon(int port);  HttpDaemon(); static void registerServlet(String urlPattern, HttpServlet servlet); static int getPort(); static HttpDaemon getSingleton(); void start(); void stop(); boolean isAlive(); boolean isStarted(); int aliveRequests(); static int sPort; }