Package org.jboss.com.sun.net.httpserver

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


            int port = server.getAddress().getPort();
            String s = "http://localhost:"+port+"/apps/foo";
            URL url = new URL (s);
            InputStream is = url.openStream();
            read (is);
            server.stop (1);
            if (error) {
                throw new RuntimeException ("error in test");
            }

        }
View Full Code Here


        } catch (SocketTimeoutException e) {
            System.out.println ("Did not received expected data");
            ok = false;
        } finally {
            s.close();
            server.stop(2);
        }

        if (requests != 1) {
            throw new RuntimeException ("server handler did not receive the request");
        }
View Full Code Here

            while (is.read()!= -1) {
                c ++;
            }
            is.close();
        } finally {
            server.stop(2);
            executor.shutdown();
        }
        if (error) {
            throw new RuntimeException ("Test failed");
        }
View Full Code Here

            is = urlc.getInputStream();
            while (is.read()!= -1);
            is.close ();

        } catch (IOException e) {
            server.stop(2);
            executor.shutdown();
            throw new RuntimeException ("Test failed");
        }
        server.stop(2);
        executor.shutdown();
View Full Code Here

        } catch (IOException e) {
            server.stop(2);
            executor.shutdown();
            throw new RuntimeException ("Test failed");
        }
        server.stop(2);
        executor.shutdown();
        System.out.println ("OK");
    }

    public static boolean error = false;
View Full Code Here

            int c = 0;
            while (is.read()!= -1) {
                c ++;
            }
        } catch (IOException e) {
            server.stop(2);
            executor.shutdown();
            System.out.println ("OK");
        }
    }
View Full Code Here

        }
        if (error) {
            throw new RuntimeException ("test failed error");
        }
        delay();
        server.stop(2);
        executor.shutdown();
        System.out.println ("OK");

    }
View Full Code Here

            while(is.read(ba) != -1);
            is.close();

            pass();
        } finally {
            httpServer.stop(0);
        }
    }

    /**
     * Http Server
View Full Code Here

                s.append (c);
                finished = s.indexOf ("\r\n\r\nhello") != -1;
                /* test will timeout otherwise */
            }
        } catch (SocketTimeoutException e) {
            server.stop (2);
            executor.shutdown ();
            throw new RuntimeException ("Test failed in test1");
        }

        System.out.println (new String (s));
View Full Code Here

        try {
            while ((c=is.read()) != -1) {
                buf[i++] = (byte)c;
            }
        } catch (SocketTimeoutException e) {
            server.stop (2);
            executor.shutdown ();
            throw new RuntimeException ("Test failed in test2");
        }

        String ss = new String (buf, "ISO-8859-1");
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.