Package com.sun.net.httpserver

Examples of com.sun.net.httpserver.HttpServer.stop()


            String s = r.type("text/plain").post(String.class, "CONTENT");
            assertEquals("CONTENT", s);
        } finally {
            if (server != null)
                server.stop(getEnvVariable("JERSEY_HTTP_STOPSEC", 0));
        }
    }

    private static int getEnvVariable(final String varName, int defaultValue) {
        if (null == varName) {
View Full Code Here


        } catch (Exception e) {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            e.printStackTrace(new PrintStream(baos));
            Assert.assertTrue(baos.toString().contains("SocketTimeoutException: Read timed out"));
        }
        httpServer.stop(0);
    }

    private static class HelloRESTEasyInterface extends BaseService {
        private static Set<ServiceOperation> _operations = new HashSet<ServiceOperation>(3);
        static {
View Full Code Here

        } catch (Exception e) {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            e.printStackTrace(new PrintStream(baos));
            Assert.assertTrue(baos.toString().contains("SocketTimeoutException: Read timed out"));
        }
        httpServer.stop(0);
    }

    @Ignore // mime headers are not parsed into the SOAPMessage with CXF
    @Test
    public void invokeRequestResponse() throws Exception {
View Full Code Here

                    _applicationContext.getBean(MetadataNotifierTask.class).run();
                }
            });
        } finally {
            httpServer.stop(0);
        }

        assertTrue(notified.get());
    }
}
View Full Code Here

            httpServer.start();
            final XmlRequest xmlRequest = new GeonetHttpRequestFactory().createXmlRequest(new URL ("http://localhost:"+port+ urlPath));
            final Element response = xmlRequest.execute();
            assertEquals(Xml.getString(expectedResponse), Xml.getString(response));
        } finally {
            httpServer.stop(0);
        }
    }

    @Test
    @Ignore // Ignore because it requires a running instance
View Full Code Here

            xmlRequest = new GeonetHttpRequestFactory().createXmlRequest(new URL ("http://localhost:"+port+ tempUrlPath));
            response = xmlRequest.execute();
            assertEquals(Xml.getString(expectedResponse), Xml.getString(response));
        } finally {
            httpServer.stop(0);
        }
    }

    @Test
    public void testCreateXmlRequestURL() throws Exception {
View Full Code Here

            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        } finally {
            if (server != null)
                server.stop(0);
        }
    }

    public static void main(String[] args) {
        test();
View Full Code Here

                    .request()
                    .get();

            assertThat(response.readEntity(String.class), is("get"));
        } finally {
            server.stop(0);
        }
    }
}
View Full Code Here

        HttpServer server = App.startServer();

        WebTarget target = ClientBuilder.newClient().target(App.getBaseURI() + "helloworld");
        assertEquals(HelloWorldResource.CLICHED_MESSAGE, target.request(MediaType.TEXT_PLAIN).get(String.class));

        server.stop(0);
    }
}
View Full Code Here

    System.out.println("SERVER RUNNING: http://localhost:" + mapArgs.get("port") + '/');
    System.out.println("Hit return to stop...");
    System.in.read();
    System.out.println("Stopping server");
    server.stop(0);
    System.out.println("Server stopped");
  }

  private static Map<String, String> parseArgs(String[] args) {
    Map<String, String> mapProps = new HashMap<String, String>();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.