Java Code Examples for org.glassfish.grizzly.http.server.HttpServer#stop()
The following examples show how to use
org.glassfish.grizzly.http.server.HttpServer#stop() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ServletRegistrationComponentTest.java From roboconf-platform with Apache License 2.0 | 6 votes |
@Test public void testJsonSerialization_application() throws Exception { // This test guarantees that in an non-OSGi environment, // our REST application uses the properties we define. // And, in particular, the JSon serialization that we tailored. URI uri = UriBuilder.fromUri( "http://localhost/" ).port( 8090 ).build(); RestApplication restApp = new RestApplication( this.manager ); HttpServer httpServer = null; String received = null; try { httpServer = GrizzlyServerFactory.createHttpServer( uri, restApp ); Assert.assertTrue( httpServer.isStarted()); URI targetUri = UriBuilder.fromUri( uri ).path( UrlConstants.APPLICATIONS ).build(); received = Utils.readUrlContent( targetUri.toString()); } finally { if( httpServer != null ) httpServer.stop(); } String expected = JSonBindingUtils.createObjectMapper().writeValueAsString( Arrays.asList( this.app )); Assert.assertEquals( expected, received ); }
Example 2
Source File: Main.java From RestExpress-Examples with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws IOException { final HttpServer server = startServer(); System.out.println(String.format( "Jersey app started with WADL available at " + "%sapplication.wadl\nHit enter to stop it...", BASE_URI)); System.in.read(); server.stop(); }
Example 3
Source File: ServletRegistrationComponentTest.java From roboconf-platform with Apache License 2.0 | 5 votes |
@Test public void testJsonSerialization_instance() throws Exception { // This test guarantees that in an non-OSGi environment, // our REST application uses the properties we define. // And, in particular, the JSon serialization that we tailored. URI uri = UriBuilder.fromUri( "http://localhost/" ).port( 8090 ).build(); RestApplication restApp = new RestApplication( this.manager ); HttpServer httpServer = null; String received = null; try { httpServer = GrizzlyServerFactory.createHttpServer( uri, restApp ); Assert.assertTrue( httpServer.isStarted()); URI targetUri = UriBuilder.fromUri( uri ) .path( UrlConstants.APP ).path( this.app.getName()).path( "instances" ) .queryParam( "instance-path", "/tomcat-vm" ).build(); received = Utils.readUrlContent( targetUri.toString()); } finally { if( httpServer != null ) httpServer.stop(); } String expected = JSonBindingUtils.createObjectMapper().writeValueAsString( Arrays.asList( this.app.getTomcat())); Assert.assertEquals( expected, received ); }
Example 4
Source File: Main.java From http-server-benchmarks with MIT License | 4 votes |
public static void main(String[] args) throws IOException { final HttpServer server = startServer(); System.out.println(String.format("Jersey app started.")); System.in.read(); server.stop(); }