test/jdk/java/net/httpclient/SplitResponse.java
branchhttp-client-branch
changeset 55963 ae2750657f98
parent 55962 35376c843df1
child 55973 4d9b002587db
--- a/test/jdk/java/net/httpclient/SplitResponse.java	Wed Dec 06 12:05:38 2017 +0000
+++ b/test/jdk/java/net/httpclient/SplitResponse.java	Wed Dec 06 12:18:08 2017 +0000
@@ -132,6 +132,34 @@
         out.println("server is: " + uri);
         server.start();
 
+
+        // The following code can be uncommented to verify that the
+        // MockServer will reject rogue requests whose URI does not
+        // contain "/foo/".
+        //
+        //        Thread rogue = new Thread() {
+        //            public void run() {
+        //                try {
+        //                    HttpClient client = newHttpClient();
+        //                    URI uri2 = URI.create(uri.toString().replace("/foo/","/"));
+        //                    HttpRequest request = HttpRequest
+        //                        .newBuilder(uri2).version(version).build();
+        //                    while (true) {
+        //                        try {
+        //                            client.send(request, HttpResponse.BodyHandler.asString());
+        //                        } catch (IOException ex) {
+        //                            System.out.println("Client rejected " + request);
+        //                        }
+        //                        sleep(250);
+        //                    }
+        //                } catch ( Throwable x) {
+        //                }
+        //            }
+        //        };
+        //        rogue.setDaemon(true);
+        //        rogue.start();
+
+
         HttpClient client = newHttpClient();
         HttpRequest request = HttpRequest.newBuilder(uri).version(version).build();
         HttpResponse<String> r;