mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 03:24:38 +02:00
6354758: rename old test HttpServer classes
Reviewed-by: chegar, michaelm, khazra
This commit is contained in:
parent
de965a866a
commit
8fbd047f8c
26 changed files with 98 additions and 99 deletions
|
@ -25,7 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 4678055
|
* @bug 4678055
|
||||||
* @library ../../../sun/net/www/httptest/
|
* @library ../../../sun/net/www/httptest/
|
||||||
* @build HttpCallback HttpServer ClosedChannelList HttpTransaction
|
* @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
|
||||||
* @run main B4678055
|
* @run main B4678055
|
||||||
* @summary Basic Authentication fails with multiple realms
|
* @summary Basic Authentication fails with multiple realms
|
||||||
*/
|
*/
|
||||||
|
@ -119,13 +119,13 @@ public class B4678055 implements HttpCallback {
|
||||||
is.close();
|
is.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
static HttpServer server;
|
static TestHttpServer server;
|
||||||
|
|
||||||
public static void main (String[] args) throws Exception {
|
public static void main (String[] args) throws Exception {
|
||||||
MyAuthenticator auth = new MyAuthenticator ();
|
MyAuthenticator auth = new MyAuthenticator ();
|
||||||
Authenticator.setDefault (auth);
|
Authenticator.setDefault (auth);
|
||||||
try {
|
try {
|
||||||
server = new HttpServer (new B4678055(), 1, 10, 0);
|
server = new TestHttpServer (new B4678055(), 1, 10, 0);
|
||||||
System.out.println ("Server: listening on port: " + server.getLocalPort());
|
System.out.println ("Server: listening on port: " + server.getLocalPort());
|
||||||
client ("http://localhost:"+server.getLocalPort()+"/d1/foo.html");
|
client ("http://localhost:"+server.getLocalPort()+"/d1/foo.html");
|
||||||
client ("http://localhost:"+server.getLocalPort()+"/d2/foo.html");
|
client ("http://localhost:"+server.getLocalPort()+"/d2/foo.html");
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 4722333
|
* @bug 4722333
|
||||||
* @library ../../../sun/net/www/httptest/
|
* @library ../../../sun/net/www/httptest/
|
||||||
* @build HttpCallback HttpServer ClosedChannelList HttpTransaction
|
* @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
|
||||||
* @run main B4722333
|
* @run main B4722333
|
||||||
* @summary JRE Proxy Authentication Not Working with ISA2000
|
* @summary JRE Proxy Authentication Not Working with ISA2000
|
||||||
*/
|
*/
|
||||||
|
@ -114,13 +114,13 @@ public class B4722333 implements HttpCallback {
|
||||||
is.close();
|
is.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
static HttpServer server;
|
static TestHttpServer server;
|
||||||
|
|
||||||
public static void main (String[] args) throws Exception {
|
public static void main (String[] args) throws Exception {
|
||||||
MyAuthenticator auth = new MyAuthenticator ();
|
MyAuthenticator auth = new MyAuthenticator ();
|
||||||
Authenticator.setDefault (auth);
|
Authenticator.setDefault (auth);
|
||||||
try {
|
try {
|
||||||
server = new HttpServer (new B4722333(), 1, 10, 0);
|
server = new TestHttpServer (new B4722333(), 1, 10, 0);
|
||||||
System.out.println ("Server started: listening on port: " + server.getLocalPort());
|
System.out.println ("Server started: listening on port: " + server.getLocalPort());
|
||||||
client ("http://localhost:"+server.getLocalPort()+"/d1/d2/d3/foo.html");
|
client ("http://localhost:"+server.getLocalPort()+"/d1/d2/d3/foo.html");
|
||||||
client ("http://localhost:"+server.getLocalPort()+"/ASD/d3/x.html");
|
client ("http://localhost:"+server.getLocalPort()+"/ASD/d3/x.html");
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 4759514
|
* @bug 4759514
|
||||||
* @library ../../../sun/net/www/httptest/
|
* @library ../../../sun/net/www/httptest/
|
||||||
* @build HttpCallback HttpServer ClosedChannelList HttpTransaction
|
* @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
|
||||||
* @run main B4759514
|
* @run main B4759514
|
||||||
* @summary Digest Authentication is erroniously quoting the nc value, contrary to RFC 2617
|
* @summary Digest Authentication is erroniously quoting the nc value, contrary to RFC 2617
|
||||||
*/
|
*/
|
||||||
|
@ -91,13 +91,13 @@ public class B4759514 implements HttpCallback {
|
||||||
is.close();
|
is.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
static HttpServer server;
|
static TestHttpServer server;
|
||||||
|
|
||||||
public static void main (String[] args) throws Exception {
|
public static void main (String[] args) throws Exception {
|
||||||
MyAuthenticator auth = new MyAuthenticator ();
|
MyAuthenticator auth = new MyAuthenticator ();
|
||||||
Authenticator.setDefault (auth);
|
Authenticator.setDefault (auth);
|
||||||
try {
|
try {
|
||||||
server = new HttpServer (new B4759514(), 1, 10, 0);
|
server = new TestHttpServer (new B4759514(), 1, 10, 0);
|
||||||
System.out.println ("Server: listening on port: " + server.getLocalPort());
|
System.out.println ("Server: listening on port: " + server.getLocalPort());
|
||||||
client ("http://localhost:"+server.getLocalPort()+"/d1/foo.html");
|
client ("http://localhost:"+server.getLocalPort()+"/d1/foo.html");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 4769350
|
* @bug 4769350
|
||||||
* @library ../../../sun/net/www/httptest/
|
* @library ../../../sun/net/www/httptest/
|
||||||
* @build HttpCallback HttpServer ClosedChannelList HttpTransaction AbstractCallback
|
* @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction AbstractCallback
|
||||||
* @run main/othervm B4769350 server
|
* @run main/othervm B4769350 server
|
||||||
* @run main/othervm B4769350 proxy
|
* @run main/othervm B4769350 proxy
|
||||||
* @summary proxy authentication username and password caching only works in serial case
|
* @summary proxy authentication username and password caching only works in serial case
|
||||||
|
@ -142,10 +142,10 @@ public class B4769350 {
|
||||||
switch (count) {
|
switch (count) {
|
||||||
case 0:
|
case 0:
|
||||||
errorReply (req, "Basic realm=\"realm1\"");
|
errorReply (req, "Basic realm=\"realm1\"");
|
||||||
HttpServer.rendezvous ("one", 2);
|
TestHttpServer.rendezvous ("one", 2);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
HttpServer.waitForCondition ("cond2");
|
TestHttpServer.waitForCondition ("cond2");
|
||||||
okReply (req);
|
okReply (req);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -158,11 +158,11 @@ public class B4769350 {
|
||||||
switch (count) {
|
switch (count) {
|
||||||
case 0:
|
case 0:
|
||||||
errorReply (req, "Basic realm=\"realm2\"");
|
errorReply (req, "Basic realm=\"realm2\"");
|
||||||
HttpServer.rendezvous ("one", 2);
|
TestHttpServer.rendezvous ("one", 2);
|
||||||
HttpServer.setCondition ("cond1");
|
TestHttpServer.setCondition ("cond1");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
HttpServer.waitForCondition ("cond2");
|
TestHttpServer.waitForCondition ("cond2");
|
||||||
okReply (req);
|
okReply (req);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -174,7 +174,7 @@ public class B4769350 {
|
||||||
switch (count) {
|
switch (count) {
|
||||||
case 0:
|
case 0:
|
||||||
errorReply (req, "Basic realm=\"realm1\"");
|
errorReply (req, "Basic realm=\"realm1\"");
|
||||||
HttpServer.rendezvous ("two", 2);
|
TestHttpServer.rendezvous ("two", 2);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
okReply (req);
|
okReply (req);
|
||||||
|
@ -188,8 +188,8 @@ public class B4769350 {
|
||||||
switch (count) {
|
switch (count) {
|
||||||
case 0:
|
case 0:
|
||||||
errorReply (req, "Basic realm=\"realm2\"");
|
errorReply (req, "Basic realm=\"realm2\"");
|
||||||
HttpServer.rendezvous ("two", 2);
|
TestHttpServer.rendezvous ("two", 2);
|
||||||
HttpServer.setCondition ("cond2");
|
TestHttpServer.setCondition ("cond2");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
okReply (req);
|
okReply (req);
|
||||||
|
@ -207,7 +207,7 @@ public class B4769350 {
|
||||||
void doT2a (HttpTransaction req, int count) throws IOException {
|
void doT2a (HttpTransaction req, int count) throws IOException {
|
||||||
/* This will be called several times */
|
/* This will be called several times */
|
||||||
if (count == 1) {
|
if (count == 1) {
|
||||||
HttpServer.setCondition ("T2cond1");
|
TestHttpServer.setCondition ("T2cond1");
|
||||||
}
|
}
|
||||||
errorReply (req, "Basic realm=\"realm3\"");
|
errorReply (req, "Basic realm=\"realm3\"");
|
||||||
}
|
}
|
||||||
|
@ -233,7 +233,7 @@ public class B4769350 {
|
||||||
switch (count) {
|
switch (count) {
|
||||||
case 0:
|
case 0:
|
||||||
proxyReply (req, "Basic realm=\"proxy\"");
|
proxyReply (req, "Basic realm=\"proxy\"");
|
||||||
HttpServer.setCondition ("T3cond1");
|
TestHttpServer.setCondition ("T3cond1");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
errorReply (req, "Basic realm=\"realm4\"");
|
errorReply (req, "Basic realm=\"realm4\"");
|
||||||
|
@ -260,7 +260,7 @@ public class B4769350 {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static HttpServer server;
|
static TestHttpServer server;
|
||||||
static MyAuthenticator auth = new MyAuthenticator ();
|
static MyAuthenticator auth = new MyAuthenticator ();
|
||||||
|
|
||||||
static int redirects = 4;
|
static int redirects = 4;
|
||||||
|
@ -276,7 +276,7 @@ public class B4769350 {
|
||||||
c4 = new Client (authority, "/test/realm2/t1d", false);
|
c4 = new Client (authority, "/test/realm2/t1d", false);
|
||||||
|
|
||||||
c1.start(); c2.start();
|
c1.start(); c2.start();
|
||||||
HttpServer.waitForCondition ("cond1");
|
TestHttpServer.waitForCondition ("cond1");
|
||||||
c3.start(); c4.start();
|
c3.start(); c4.start();
|
||||||
c1.join(); c2.join(); c3.join(); c4.join();
|
c1.join(); c2.join(); c3.join(); c4.join();
|
||||||
|
|
||||||
|
@ -294,7 +294,7 @@ public class B4769350 {
|
||||||
c5 = new Client (authority, "/test/realm3/t2a", true);
|
c5 = new Client (authority, "/test/realm3/t2a", true);
|
||||||
c6 = new Client (authority, "/test/realm3/t2b", false);
|
c6 = new Client (authority, "/test/realm3/t2b", false);
|
||||||
c5.start ();
|
c5.start ();
|
||||||
HttpServer.waitForCondition ("T2cond1");
|
TestHttpServer.waitForCondition ("T2cond1");
|
||||||
c6.start ();
|
c6.start ();
|
||||||
c5.join(); c6.join();
|
c5.join(); c6.join();
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ public class B4769350 {
|
||||||
c8 = new Client (authority, "/test/realm4/t3b", false);
|
c8 = new Client (authority, "/test/realm4/t3b", false);
|
||||||
c9 = new Client (authority, "/test/realm4/t3c", false);
|
c9 = new Client (authority, "/test/realm4/t3c", false);
|
||||||
c7.start ();
|
c7.start ();
|
||||||
HttpServer.waitForCondition ("T3cond1");
|
TestHttpServer.waitForCondition ("T3cond1");
|
||||||
c8.start ();
|
c8.start ();
|
||||||
c9.start ();
|
c9.start ();
|
||||||
c7.join(); c8.join(); c9.join();
|
c7.join(); c8.join(); c9.join();
|
||||||
|
@ -333,7 +333,7 @@ public class B4769350 {
|
||||||
Authenticator.setDefault (auth);
|
Authenticator.setDefault (auth);
|
||||||
boolean proxy = args[0].equals ("proxy");
|
boolean proxy = args[0].equals ("proxy");
|
||||||
try {
|
try {
|
||||||
server = new HttpServer (new CallBack(), 10, 1, 0);
|
server = new TestHttpServer (new CallBack(), 10, 1, 0);
|
||||||
System.out.println ("Server: listening on port: " + server.getLocalPort());
|
System.out.println ("Server: listening on port: " + server.getLocalPort());
|
||||||
if (proxy) {
|
if (proxy) {
|
||||||
System.setProperty ("http.proxyHost", "localhost");
|
System.setProperty ("http.proxyHost", "localhost");
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 4921848
|
* @bug 4921848
|
||||||
* @library ../../../sun/net/www/httptest/
|
* @library ../../../sun/net/www/httptest/
|
||||||
* @build HttpCallback HttpServer ClosedChannelList HttpTransaction
|
* @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
|
||||||
* @run main/othervm -Dhttp.auth.preference=basic B4921848
|
* @run main/othervm -Dhttp.auth.preference=basic B4921848
|
||||||
* @summary Allow user control over authentication schemes
|
* @summary Allow user control over authentication schemes
|
||||||
*/
|
*/
|
||||||
|
@ -82,13 +82,13 @@ public class B4921848 implements HttpCallback {
|
||||||
is.close();
|
is.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
static HttpServer server;
|
static TestHttpServer server;
|
||||||
|
|
||||||
public static void main (String[] args) throws Exception {
|
public static void main (String[] args) throws Exception {
|
||||||
MyAuthenticator auth = new MyAuthenticator ();
|
MyAuthenticator auth = new MyAuthenticator ();
|
||||||
Authenticator.setDefault (auth);
|
Authenticator.setDefault (auth);
|
||||||
try {
|
try {
|
||||||
server = new HttpServer (new B4921848(), 1, 10, 0);
|
server = new TestHttpServer (new B4921848(), 1, 10, 0);
|
||||||
System.out.println ("Server started: listening on port: " + server.getLocalPort());
|
System.out.println ("Server started: listening on port: " + server.getLocalPort());
|
||||||
client ("http://localhost:"+server.getLocalPort()+"/d1/d2/d3/foo.html");
|
client ("http://localhost:"+server.getLocalPort()+"/d1/d2/d3/foo.html");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -119,7 +119,7 @@ public class B4933582 implements HttpCallback {
|
||||||
is.close();
|
is.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
static HttpServer server;
|
static TestHttpServer server;
|
||||||
|
|
||||||
public static void main (String[] args) throws Exception {
|
public static void main (String[] args) throws Exception {
|
||||||
firstTime = args[0].equals ("first");
|
firstTime = args[0].equals ("first");
|
||||||
|
@ -128,11 +128,11 @@ public class B4933582 implements HttpCallback {
|
||||||
CacheImpl cache;
|
CacheImpl cache;
|
||||||
try {
|
try {
|
||||||
if (firstTime) {
|
if (firstTime) {
|
||||||
server = new HttpServer (new B4933582(), 1, 10, 0);
|
server = new TestHttpServer (new B4933582(), 1, 10, 0);
|
||||||
cache = new CacheImpl (server.getLocalPort());
|
cache = new CacheImpl (server.getLocalPort());
|
||||||
} else {
|
} else {
|
||||||
cache = new CacheImpl ();
|
cache = new CacheImpl ();
|
||||||
server = new HttpServer(new B4933582(), 1, 10, cache.getPort());
|
server = new TestHttpServer(new B4933582(), 1, 10, cache.getPort());
|
||||||
}
|
}
|
||||||
AuthCacheValue.setAuthCache (cache);
|
AuthCacheValue.setAuthCache (cache);
|
||||||
System.out.println ("Server: listening on port: " + server.getLocalPort());
|
System.out.println ("Server: listening on port: " + server.getLocalPort());
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 4962064
|
* @bug 4962064
|
||||||
* @library ../../../sun/net/www/httptest/
|
* @library ../../../sun/net/www/httptest/
|
||||||
* @build HttpCallback HttpServer ClosedChannelList HttpTransaction
|
* @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
|
||||||
* @run main/othervm B4962064
|
* @run main/othervm B4962064
|
||||||
* @summary Extend Authenticator to provide access to request URI and server/proxy
|
* @summary Extend Authenticator to provide access to request URI and server/proxy
|
||||||
*/
|
*/
|
||||||
|
@ -85,12 +85,12 @@ public class B4962064 implements HttpCallback {
|
||||||
is.close();
|
is.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
static HttpServer server;
|
static TestHttpServer server;
|
||||||
static URL urlsave;
|
static URL urlsave;
|
||||||
|
|
||||||
public static void main (String[] args) throws Exception {
|
public static void main (String[] args) throws Exception {
|
||||||
try {
|
try {
|
||||||
server = new HttpServer (new B4962064(), 1, 10, 0);
|
server = new TestHttpServer (new B4962064(), 1, 10, 0);
|
||||||
int port = server.getLocalPort();
|
int port = server.getLocalPort();
|
||||||
System.setProperty ("http.proxyHost", "localhost");
|
System.setProperty ("http.proxyHost", "localhost");
|
||||||
System.setProperty ("http.proxyPort", Integer.toString (port));
|
System.setProperty ("http.proxyPort", Integer.toString (port));
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* @summary Unit test for java.net.CookieManager
|
* @summary Unit test for java.net.CookieManager
|
||||||
* @bug 6244040
|
* @bug 6244040
|
||||||
* @library ../../../sun/net/www/httptest/
|
* @library ../../../sun/net/www/httptest/
|
||||||
* @build HttpCallback HttpServer ClosedChannelList HttpTransaction
|
* @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
|
||||||
* @run main/othervm -ea CookieManagerTest
|
* @run main/othervm -ea CookieManagerTest
|
||||||
* @author Edward Wang
|
* @author Edward Wang
|
||||||
*/
|
*/
|
||||||
|
@ -38,7 +38,7 @@ import sun.net.www.MessageHeader;
|
||||||
|
|
||||||
public class CookieManagerTest {
|
public class CookieManagerTest {
|
||||||
static CookieHttpTransaction httpTrans;
|
static CookieHttpTransaction httpTrans;
|
||||||
static HttpServer server;
|
static TestHttpServer server;
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
startHttpServer();
|
startHttpServer();
|
||||||
|
@ -52,7 +52,7 @@ public class CookieManagerTest {
|
||||||
public static void startHttpServer() {
|
public static void startHttpServer() {
|
||||||
try {
|
try {
|
||||||
httpTrans = new CookieHttpTransaction();
|
httpTrans = new CookieHttpTransaction();
|
||||||
server = new HttpServer(httpTrans, 1, 1, 0);
|
server = new TestHttpServer(httpTrans, 1, 1, 0);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* @bug 4924226
|
* @bug 4924226
|
||||||
* @summary PIT: Can no launch jnlp application via 127.0.0.1 address on the web server
|
* @summary PIT: Can no launch jnlp application via 127.0.0.1 address on the web server
|
||||||
* @library ../../../sun/net/www/httptest/
|
* @library ../../../sun/net/www/httptest/
|
||||||
* @build ClosedChannelList HttpServer HttpTransaction HttpCallback
|
* @build ClosedChannelList TestHttpServer HttpTransaction HttpCallback
|
||||||
* @compile LoopbackAddresses.java
|
* @compile LoopbackAddresses.java
|
||||||
* @run main/othervm LoopbackAddresses
|
* @run main/othervm LoopbackAddresses
|
||||||
*/
|
*/
|
||||||
|
@ -39,7 +39,7 @@ import java.io.*;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class LoopbackAddresses implements HttpCallback {
|
public class LoopbackAddresses implements HttpCallback {
|
||||||
static HttpServer server;
|
static TestHttpServer server;
|
||||||
|
|
||||||
public void request (HttpTransaction req) {
|
public void request (HttpTransaction req) {
|
||||||
req.setResponseEntityBody ("Hello .");
|
req.setResponseEntityBody ("Hello .");
|
||||||
|
@ -52,7 +52,7 @@ public class LoopbackAddresses implements HttpCallback {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
try {
|
try {
|
||||||
server = new HttpServer (new LoopbackAddresses(), 1, 10, 0);
|
server = new TestHttpServer (new LoopbackAddresses(), 1, 10, 0);
|
||||||
ProxyServer pserver = new ProxyServer(InetAddress.getByName("localhost"), server.getLocalPort());
|
ProxyServer pserver = new ProxyServer(InetAddress.getByName("localhost"), server.getLocalPort());
|
||||||
// start proxy server
|
// start proxy server
|
||||||
new Thread(pserver).start();
|
new Thread(pserver).start();
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* @bug 4696512
|
* @bug 4696512
|
||||||
* @summary HTTP client: Improve proxy server configuration and selection
|
* @summary HTTP client: Improve proxy server configuration and selection
|
||||||
* @library ../../../sun/net/www/httptest/
|
* @library ../../../sun/net/www/httptest/
|
||||||
* @build ClosedChannelList HttpServer HttpTransaction HttpCallback
|
* @build ClosedChannelList TestHttpServer HttpTransaction HttpCallback
|
||||||
* @compile ProxyTest.java
|
* @compile ProxyTest.java
|
||||||
* @run main/othervm -Dhttp.proxyHost=inexistant -Dhttp.proxyPort=8080 ProxyTest
|
* @run main/othervm -Dhttp.proxyHost=inexistant -Dhttp.proxyPort=8080 ProxyTest
|
||||||
*/
|
*/
|
||||||
|
@ -36,7 +36,7 @@ import java.io.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class ProxyTest implements HttpCallback {
|
public class ProxyTest implements HttpCallback {
|
||||||
static HttpServer server;
|
static TestHttpServer server;
|
||||||
|
|
||||||
public ProxyTest() {
|
public ProxyTest() {
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ public class ProxyTest implements HttpCallback {
|
||||||
throw new RuntimeException("Default ProxySelector is null");
|
throw new RuntimeException("Default ProxySelector is null");
|
||||||
ProxySelector.setDefault(new MyProxySelector());
|
ProxySelector.setDefault(new MyProxySelector());
|
||||||
try {
|
try {
|
||||||
server = new HttpServer (new ProxyTest(), 1, 10, 0);
|
server = new TestHttpServer (new ProxyTest(), 1, 10, 0);
|
||||||
URL url = new URL("http://localhost:"+server.getLocalPort());
|
URL url = new URL("http://localhost:"+server.getLocalPort());
|
||||||
System.out.println ("client opening connection to: " + url);
|
System.out.println ("client opening connection to: " + url);
|
||||||
HttpURLConnection urlc = (HttpURLConnection)url.openConnection ();
|
HttpURLConnection urlc = (HttpURLConnection)url.openConnection ();
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* @bug 4920526
|
* @bug 4920526
|
||||||
* @summary Needs per connection proxy support for URLs
|
* @summary Needs per connection proxy support for URLs
|
||||||
* @library ../../../sun/net/www/httptest/
|
* @library ../../../sun/net/www/httptest/
|
||||||
* @build ClosedChannelList HttpServer HttpTransaction HttpCallback
|
* @build ClosedChannelList TestHttpServer HttpTransaction HttpCallback
|
||||||
* @compile PerConnectionProxy.java
|
* @compile PerConnectionProxy.java
|
||||||
* @run main/othervm -Dhttp.proxyHost=inexistant -Dhttp.proxyPort=8080 PerConnectionProxy
|
* @run main/othervm -Dhttp.proxyHost=inexistant -Dhttp.proxyPort=8080 PerConnectionProxy
|
||||||
*/
|
*/
|
||||||
|
@ -35,7 +35,7 @@ import java.io.*;
|
||||||
import sun.net.www.*;
|
import sun.net.www.*;
|
||||||
|
|
||||||
public class PerConnectionProxy implements HttpCallback {
|
public class PerConnectionProxy implements HttpCallback {
|
||||||
static HttpServer server;
|
static TestHttpServer server;
|
||||||
|
|
||||||
public void request (HttpTransaction req) {
|
public void request (HttpTransaction req) {
|
||||||
req.setResponseEntityBody ("Hello .");
|
req.setResponseEntityBody ("Hello .");
|
||||||
|
@ -48,7 +48,7 @@ public class PerConnectionProxy implements HttpCallback {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
try {
|
try {
|
||||||
server = new HttpServer (new PerConnectionProxy(), 1, 10, 0);
|
server = new TestHttpServer (new PerConnectionProxy(), 1, 10, 0);
|
||||||
ProxyServer pserver = new ProxyServer(InetAddress.getByName("localhost"), server.getLocalPort());
|
ProxyServer pserver = new ProxyServer(InetAddress.getByName("localhost"), server.getLocalPort());
|
||||||
// start proxy server
|
// start proxy server
|
||||||
new Thread(pserver).start();
|
new Thread(pserver).start();
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 5052093
|
* @bug 5052093
|
||||||
* @library ../../../sun/net/www/httptest/
|
* @library ../../../sun/net/www/httptest/
|
||||||
* @build HttpCallback HttpServer ClosedChannelList HttpTransaction
|
* @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
|
||||||
* @run main B5052093
|
* @run main B5052093
|
||||||
* @summary URLConnection doesn't support large files
|
* @summary URLConnection doesn't support large files
|
||||||
*/
|
*/
|
||||||
|
@ -34,7 +34,7 @@ import java.io.*;
|
||||||
import sun.net.www.protocol.file.FileURLConnection;
|
import sun.net.www.protocol.file.FileURLConnection;
|
||||||
|
|
||||||
public class B5052093 implements HttpCallback {
|
public class B5052093 implements HttpCallback {
|
||||||
private static HttpServer server;
|
private static TestHttpServer server;
|
||||||
private static long testSize = ((long) (Integer.MAX_VALUE)) + 2;
|
private static long testSize = ((long) (Integer.MAX_VALUE)) + 2;
|
||||||
|
|
||||||
public static class LargeFile extends File {
|
public static class LargeFile extends File {
|
||||||
|
@ -63,7 +63,7 @@ public class B5052093 implements HttpCallback {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
server = new HttpServer(new B5052093(), 1, 10, 0);
|
server = new TestHttpServer(new B5052093(), 1, 10, 0);
|
||||||
try {
|
try {
|
||||||
URL url = new URL("http://localhost:"+server.getLocalPort()+"/foo");
|
URL url = new URL("http://localhost:"+server.getLocalPort()+"/foo");
|
||||||
URLConnection conn = url.openConnection();
|
URLConnection conn = url.openConnection();
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 4804309
|
* @bug 4804309
|
||||||
* @library ../../../sun/net/www/httptest/
|
* @library ../../../sun/net/www/httptest/
|
||||||
* @build HttpCallback HttpServer ClosedChannelList HttpTransaction
|
* @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
|
||||||
* @run main AuthHeaderTest
|
* @run main AuthHeaderTest
|
||||||
* @summary AuthHeaderTest bug
|
* @summary AuthHeaderTest bug
|
||||||
*/
|
*/
|
||||||
|
@ -90,13 +90,13 @@ public class AuthHeaderTest implements HttpCallback {
|
||||||
is.close();
|
is.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
static HttpServer server;
|
static TestHttpServer server;
|
||||||
|
|
||||||
public static void main (String[] args) throws Exception {
|
public static void main (String[] args) throws Exception {
|
||||||
MyAuthenticator auth = new MyAuthenticator ();
|
MyAuthenticator auth = new MyAuthenticator ();
|
||||||
Authenticator.setDefault (auth);
|
Authenticator.setDefault (auth);
|
||||||
try {
|
try {
|
||||||
server = new HttpServer (new AuthHeaderTest(), 1, 10, 0);
|
server = new TestHttpServer (new AuthHeaderTest(), 1, 10, 0);
|
||||||
System.out.println ("Server: listening on port: " + server.getLocalPort());
|
System.out.println ("Server: listening on port: " + server.getLocalPort());
|
||||||
client ("http://localhost:"+server.getLocalPort()+"/d1/foo.html");
|
client ("http://localhost:"+server.getLocalPort()+"/d1/foo.html");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -24,8 +24,6 @@
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @bug 4333920 4994372
|
* @bug 4333920 4994372
|
||||||
* @library ../../../../../sun/net/www/httptest/
|
|
||||||
* @build HttpCallback HttpServer ClosedChannelList HttpTransaction
|
|
||||||
* @run main ChunkedEncodingWithProgressMonitorTest
|
* @run main ChunkedEncodingWithProgressMonitorTest
|
||||||
* @summary ChunkedEncoding unit test; MeteredStream/ProgressData problem
|
* @summary ChunkedEncoding unit test; MeteredStream/ProgressData problem
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 5045306 6356004 6993490
|
* @bug 5045306 6356004 6993490
|
||||||
* @library ../../httptest/
|
* @library ../../httptest/
|
||||||
* @build HttpCallback HttpServer HttpTransaction
|
* @build HttpCallback TestHttpServer HttpTransaction
|
||||||
* @run main/othervm B5045306
|
* @run main/othervm B5045306
|
||||||
* @summary Http keep-alive implementation is not efficient
|
* @summary Http keep-alive implementation is not efficient
|
||||||
*/
|
*/
|
||||||
|
@ -50,7 +50,7 @@ import java.lang.management.*;
|
||||||
public class B5045306
|
public class B5045306
|
||||||
{
|
{
|
||||||
static SimpleHttpTransaction httpTrans;
|
static SimpleHttpTransaction httpTrans;
|
||||||
static HttpServer server;
|
static TestHttpServer server;
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
startHttpServer();
|
startHttpServer();
|
||||||
|
@ -60,7 +60,7 @@ public class B5045306
|
||||||
public static void startHttpServer() {
|
public static void startHttpServer() {
|
||||||
try {
|
try {
|
||||||
httpTrans = new SimpleHttpTransaction();
|
httpTrans = new SimpleHttpTransaction();
|
||||||
server = new HttpServer(httpTrans, 1, 10, 0);
|
server = new TestHttpServer(httpTrans, 1, 10, 0);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class HttpTransaction {
|
||||||
|
|
||||||
String command;
|
String command;
|
||||||
URI requesturi;
|
URI requesturi;
|
||||||
HttpServer.Server server;
|
TestHttpServer.Server server;
|
||||||
MessageHeader reqheaders, reqtrailers;
|
MessageHeader reqheaders, reqtrailers;
|
||||||
String reqbody;
|
String reqbody;
|
||||||
byte[] rspbody;
|
byte[] rspbody;
|
||||||
|
@ -46,7 +46,7 @@ public class HttpTransaction {
|
||||||
int rspbodylen;
|
int rspbodylen;
|
||||||
boolean rspchunked;
|
boolean rspchunked;
|
||||||
|
|
||||||
HttpTransaction (HttpServer.Server server, String command,
|
HttpTransaction (TestHttpServer.Server server, String command,
|
||||||
URI requesturi, MessageHeader headers,
|
URI requesturi, MessageHeader headers,
|
||||||
String body, MessageHeader trailers, SelectionKey key) {
|
String body, MessageHeader trailers, SelectionKey key) {
|
||||||
this.command = command;
|
this.command = command;
|
||||||
|
@ -290,7 +290,7 @@ public class HttpTransaction {
|
||||||
* @param rTag the response string to send with the response code
|
* @param rTag the response string to send with the response code
|
||||||
*/
|
*/
|
||||||
public void sendResponse (int rCode, String rTag) throws IOException {
|
public void sendResponse (int rCode, String rTag) throws IOException {
|
||||||
OutputStream os = new HttpServer.NioOutputStream(channel());
|
OutputStream os = new TestHttpServer.NioOutputStream(channel());
|
||||||
PrintStream ps = new PrintStream (os);
|
PrintStream ps = new PrintStream (os);
|
||||||
ps.print ("HTTP/1.1 " + rCode + " " + rTag + "\r\n");
|
ps.print ("HTTP/1.1 " + rCode + " " + rTag + "\r\n");
|
||||||
if (rspheaders != null) {
|
if (rspheaders != null) {
|
||||||
|
@ -314,7 +314,7 @@ public class HttpTransaction {
|
||||||
/* sends one byte less than intended */
|
/* sends one byte less than intended */
|
||||||
|
|
||||||
public void sendPartialResponse (int rCode, String rTag)throws IOException {
|
public void sendPartialResponse (int rCode, String rTag)throws IOException {
|
||||||
OutputStream os = new HttpServer.NioOutputStream(channel());
|
OutputStream os = new TestHttpServer.NioOutputStream(channel());
|
||||||
PrintStream ps = new PrintStream (os);
|
PrintStream ps = new PrintStream (os);
|
||||||
ps.print ("HTTP/1.1 " + rCode + " " + rTag + "\r\n");
|
ps.print ("HTTP/1.1 " + rCode + " " + rTag + "\r\n");
|
||||||
ps.flush();
|
ps.flush();
|
||||||
|
|
|
@ -48,7 +48,7 @@ import java.util.*;
|
||||||
* NOTE NOTE NOTE NOTE NOTE NOTE NOTE
|
* NOTE NOTE NOTE NOTE NOTE NOTE NOTE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class HttpServer {
|
public class TestHttpServer {
|
||||||
|
|
||||||
ServerSocketChannel schan;
|
ServerSocketChannel schan;
|
||||||
int threads;
|
int threads;
|
||||||
|
@ -57,19 +57,19 @@ public class HttpServer {
|
||||||
Server[] servers;
|
Server[] servers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a <code>HttpServer<code> instance with the specified callback object
|
* Create a <code>TestHttpServer<code> instance with the specified callback object
|
||||||
* for handling requests. One thread is created to handle requests,
|
* for handling requests. One thread is created to handle requests,
|
||||||
* and up to ten TCP connections will be handled simultaneously.
|
* and up to ten TCP connections will be handled simultaneously.
|
||||||
* @param cb the callback object which is invoked to handle each
|
* @param cb the callback object which is invoked to handle each
|
||||||
* incoming request
|
* incoming request
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public HttpServer (HttpCallback cb) throws IOException {
|
public TestHttpServer (HttpCallback cb) throws IOException {
|
||||||
this (cb, 1, 10, 0);
|
this (cb, 1, 10, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a <code>HttpServer<code> instance with the specified number of
|
* Create a <code>TestHttpServer<code> instance with the specified number of
|
||||||
* threads and maximum number of connections per thread. This functions
|
* threads and maximum number of connections per thread. This functions
|
||||||
* the same as the 4 arg constructor, where the port argument is set to zero.
|
* the same as the 4 arg constructor, where the port argument is set to zero.
|
||||||
* @param cb the callback object which is invoked to handle each
|
* @param cb the callback object which is invoked to handle each
|
||||||
|
@ -80,13 +80,13 @@ public class HttpServer {
|
||||||
* handle per thread
|
* handle per thread
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public HttpServer (HttpCallback cb, int threads, int cperthread)
|
public TestHttpServer (HttpCallback cb, int threads, int cperthread)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
this (cb, threads, cperthread, 0);
|
this (cb, threads, cperthread, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a <code>HttpServer<code> instance with the specified number
|
* Create a <code>TestHttpServer<code> instance with the specified number
|
||||||
* of threads and maximum number of connections per thread and running on
|
* of threads and maximum number of connections per thread and running on
|
||||||
* the specified port. The specified number of threads are created to
|
* the specified port. The specified number of threads are created to
|
||||||
* handle incoming requests, and each thread is allowed
|
* handle incoming requests, and each thread is allowed
|
||||||
|
@ -101,7 +101,7 @@ public class HttpServer {
|
||||||
* means choose any free port.
|
* means choose any free port.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public HttpServer (HttpCallback cb, int threads, int cperthread, int port)
|
public TestHttpServer (HttpCallback cb, int threads, int cperthread, int port)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
schan = ServerSocketChannel.open ();
|
schan = ServerSocketChannel.open ();
|
||||||
InetSocketAddress addr = new InetSocketAddress (port);
|
InetSocketAddress addr = new InetSocketAddress (port);
|
|
@ -25,7 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 6296310
|
* @bug 6296310
|
||||||
* @library ../../httptest/
|
* @library ../../httptest/
|
||||||
* @build HttpCallback HttpServer HttpTransaction
|
* @build HttpCallback TestHttpServer HttpTransaction
|
||||||
* @run main/othervm B6296310
|
* @run main/othervm B6296310
|
||||||
* @summary REGRESSION: AppletClassLoader.getResourceAsStream() behaviour is wrong in some cases
|
* @summary REGRESSION: AppletClassLoader.getResourceAsStream() behaviour is wrong in some cases
|
||||||
*/
|
*/
|
||||||
|
@ -42,7 +42,7 @@ import java.util.*;
|
||||||
public class B6296310
|
public class B6296310
|
||||||
{
|
{
|
||||||
static SimpleHttpTransaction httpTrans;
|
static SimpleHttpTransaction httpTrans;
|
||||||
static HttpServer server;
|
static TestHttpServer server;
|
||||||
|
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
{
|
{
|
||||||
|
@ -55,7 +55,7 @@ public class B6296310
|
||||||
public static void startHttpServer() {
|
public static void startHttpServer() {
|
||||||
try {
|
try {
|
||||||
httpTrans = new SimpleHttpTransaction();
|
httpTrans = new SimpleHttpTransaction();
|
||||||
server = new HttpServer(httpTrans, 1, 10, 0);
|
server = new TestHttpServer(httpTrans, 1, 10, 0);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 6299712
|
* @bug 6299712
|
||||||
* @library ../../httptest/
|
* @library ../../httptest/
|
||||||
* @build HttpCallback HttpServer ClosedChannelList HttpTransaction
|
* @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
|
||||||
* @run main/othervm B6299712
|
* @run main/othervm B6299712
|
||||||
* @summary NullPointerException in sun.net.www.protocol.http.HttpURLConnection.followRedirect
|
* @summary NullPointerException in sun.net.www.protocol.http.HttpURLConnection.followRedirect
|
||||||
*/
|
*/
|
||||||
|
@ -49,7 +49,7 @@ import java.util.*;
|
||||||
*/
|
*/
|
||||||
public class B6299712 {
|
public class B6299712 {
|
||||||
static SimpleHttpTransaction httpTrans;
|
static SimpleHttpTransaction httpTrans;
|
||||||
static HttpServer server;
|
static TestHttpServer server;
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
ResponseCache.setDefault(new DeployCacheHandler());
|
ResponseCache.setDefault(new DeployCacheHandler());
|
||||||
|
@ -61,7 +61,7 @@ public class B6299712 {
|
||||||
public static void startHttpServer() {
|
public static void startHttpServer() {
|
||||||
try {
|
try {
|
||||||
httpTrans = new SimpleHttpTransaction();
|
httpTrans = new SimpleHttpTransaction();
|
||||||
server = new HttpServer(httpTrans, 1, 10, 0);
|
server = new TestHttpServer(httpTrans, 1, 10, 0);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 4726087
|
* @bug 4726087
|
||||||
* @library ../../httptest/
|
* @library ../../httptest/
|
||||||
* @build HttpCallback HttpServer ClosedChannelList HttpTransaction
|
* @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
|
||||||
* @run main RelativeRedirect
|
* @run main RelativeRedirect
|
||||||
* @summary URLConnection cannot handle redirects
|
* @summary URLConnection cannot handle redirects
|
||||||
*/
|
*/
|
||||||
|
@ -35,7 +35,7 @@ import java.net.*;
|
||||||
|
|
||||||
public class RelativeRedirect implements HttpCallback {
|
public class RelativeRedirect implements HttpCallback {
|
||||||
static int count = 0;
|
static int count = 0;
|
||||||
static HttpServer server;
|
static TestHttpServer server;
|
||||||
|
|
||||||
static class MyAuthenticator extends Authenticator {
|
static class MyAuthenticator extends Authenticator {
|
||||||
public MyAuthenticator () {
|
public MyAuthenticator () {
|
||||||
|
@ -89,7 +89,7 @@ public class RelativeRedirect implements HttpCallback {
|
||||||
MyAuthenticator auth = new MyAuthenticator ();
|
MyAuthenticator auth = new MyAuthenticator ();
|
||||||
Authenticator.setDefault (auth);
|
Authenticator.setDefault (auth);
|
||||||
try {
|
try {
|
||||||
server = new HttpServer (new RelativeRedirect(), 1, 10, 0);
|
server = new TestHttpServer (new RelativeRedirect(), 1, 10, 0);
|
||||||
System.out.println ("Server: listening on port: " + server.getLocalPort());
|
System.out.println ("Server: listening on port: " + server.getLocalPort());
|
||||||
URL url = new URL("http://localhost:"+server.getLocalPort());
|
URL url = new URL("http://localhost:"+server.getLocalPort());
|
||||||
System.out.println ("client opening connection to: " + url);
|
System.out.println ("client opening connection to: " + url);
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 6262486
|
* @bug 6262486
|
||||||
* @library ../../httptest/
|
* @library ../../httptest/
|
||||||
* @build HttpCallback HttpServer ClosedChannelList HttpTransaction
|
* @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
|
||||||
* @run main/othervm -Dhttp.keepAlive=false ResponseCacheStream
|
* @run main/othervm -Dhttp.keepAlive=false ResponseCacheStream
|
||||||
* @summary COMPATIBILITY: jagex_com - Monkey Puzzle applet fails to load
|
* @summary COMPATIBILITY: jagex_com - Monkey Puzzle applet fails to load
|
||||||
*/
|
*/
|
||||||
|
@ -91,13 +91,13 @@ public class ResponseCacheStream implements HttpCallback {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static HttpServer server;
|
static TestHttpServer server;
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
MyResponseCache cache = new MyResponseCache();
|
MyResponseCache cache = new MyResponseCache();
|
||||||
try {
|
try {
|
||||||
ResponseCache.setDefault(cache);
|
ResponseCache.setDefault(cache);
|
||||||
server = new HttpServer (new ResponseCacheStream());
|
server = new TestHttpServer (new ResponseCacheStream());
|
||||||
System.out.println ("Server: listening on port: " + server.getLocalPort());
|
System.out.println ("Server: listening on port: " + server.getLocalPort());
|
||||||
URL url = new URL ("http://127.0.0.1:"+server.getLocalPort()+"/");
|
URL url = new URL ("http://127.0.0.1:"+server.getLocalPort()+"/");
|
||||||
System.out.println ("Client: connecting to " + url);
|
System.out.println ("Client: connecting to " + url);
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 5049976
|
* @bug 5049976
|
||||||
* @library ../../httptest/
|
* @library ../../httptest/
|
||||||
* @build HttpCallback HttpServer ClosedChannelList HttpTransaction
|
@build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
|
||||||
* @run main SetChunkedStreamingMode
|
* @run main SetChunkedStreamingMode
|
||||||
* @summary Unspecified NPE is thrown when streaming output mode is enabled
|
* @summary Unspecified NPE is thrown when streaming output mode is enabled
|
||||||
*/
|
*/
|
||||||
|
@ -60,11 +60,11 @@ public class SetChunkedStreamingMode implements HttpCallback {
|
||||||
System.out.println ("finished reading");
|
System.out.println ("finished reading");
|
||||||
}
|
}
|
||||||
|
|
||||||
static HttpServer server;
|
static TestHttpServer server;
|
||||||
|
|
||||||
public static void main (String[] args) throws Exception {
|
public static void main (String[] args) throws Exception {
|
||||||
try {
|
try {
|
||||||
server = new HttpServer (new SetChunkedStreamingMode(), 1, 10, 0);
|
server = new TestHttpServer (new SetChunkedStreamingMode(), 1, 10, 0);
|
||||||
System.out.println ("Server: listening on port: " + server.getLocalPort());
|
System.out.println ("Server: listening on port: " + server.getLocalPort());
|
||||||
URL url = new URL ("http://127.0.0.1:"+server.getLocalPort()+"/");
|
URL url = new URL ("http://127.0.0.1:"+server.getLocalPort()+"/");
|
||||||
System.out.println ("Client: connecting to " + url);
|
System.out.println ("Client: connecting to " + url);
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 5026745
|
* @bug 5026745
|
||||||
* @library ../../httpstest/
|
* @library ../../httpstest/
|
||||||
|
* @build TestHttpsServer HttpCallback
|
||||||
* @run main/othervm Test
|
* @run main/othervm Test
|
||||||
*
|
*
|
||||||
* SunJSSE does not support dynamic system properties, no way to re-use
|
* SunJSSE does not support dynamic system properties, no way to re-use
|
||||||
|
@ -275,7 +276,7 @@ public class Test implements HttpCallback {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static HttpServer server;
|
static TestHttpsServer server;
|
||||||
|
|
||||||
public static void main (String[] args) throws Exception {
|
public static void main (String[] args) throws Exception {
|
||||||
// setup properties to do ssl
|
// setup properties to do ssl
|
||||||
|
@ -296,7 +297,7 @@ public class Test implements HttpCallback {
|
||||||
HttpsURLConnection.setDefaultHostnameVerifier(new NameVerifier());
|
HttpsURLConnection.setDefaultHostnameVerifier(new NameVerifier());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
server = new HttpServer (new Test(), 1, 10, 0);
|
server = new TestHttpsServer (new Test(), 1, 10, 0);
|
||||||
System.out.println ("Server started: listening on port: " + server.getLocalPort());
|
System.out.println ("Server started: listening on port: " + server.getLocalPort());
|
||||||
// the test server doesn't support keep-alive yet
|
// the test server doesn't support keep-alive yet
|
||||||
// test1("http://localhost:"+server.getLocalPort()+"/d0");
|
// test1("http://localhost:"+server.getLocalPort()+"/d0");
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class HttpTransaction {
|
||||||
|
|
||||||
String command;
|
String command;
|
||||||
URI requesturi;
|
URI requesturi;
|
||||||
HttpServer.ServerWorker server;
|
TestHttpsServer.ServerWorker server;
|
||||||
MessageHeader reqheaders, reqtrailers;
|
MessageHeader reqheaders, reqtrailers;
|
||||||
String reqbody;
|
String reqbody;
|
||||||
byte[] rspbody;
|
byte[] rspbody;
|
||||||
|
@ -46,7 +46,7 @@ public class HttpTransaction {
|
||||||
int rspbodylen;
|
int rspbodylen;
|
||||||
boolean rspchunked;
|
boolean rspchunked;
|
||||||
|
|
||||||
HttpTransaction (HttpServer.ServerWorker server, String command,
|
HttpTransaction (TestHttpsServer.ServerWorker server, String command,
|
||||||
URI requesturi, MessageHeader headers,
|
URI requesturi, MessageHeader headers,
|
||||||
String body, MessageHeader trailers, SocketChannel ch) {
|
String body, MessageHeader trailers, SocketChannel ch) {
|
||||||
this.command = command;
|
this.command = command;
|
||||||
|
@ -290,7 +290,7 @@ public class HttpTransaction {
|
||||||
* @param rTag the response string to send with the response code
|
* @param rTag the response string to send with the response code
|
||||||
*/
|
*/
|
||||||
public void sendResponse (int rCode, String rTag) throws IOException {
|
public void sendResponse (int rCode, String rTag) throws IOException {
|
||||||
OutputStream os = new HttpServer.NioOutputStream(channel(), server.getSSLEngine(), server.outNetBB(), server.outAppBB());
|
OutputStream os = new TestHttpsServer.NioOutputStream(channel(), server.getSSLEngine(), server.outNetBB(), server.outAppBB());
|
||||||
PrintStream ps = new PrintStream (os);
|
PrintStream ps = new PrintStream (os);
|
||||||
ps.print ("HTTP/1.1 " + rCode + " " + rTag + "\r\n");
|
ps.print ("HTTP/1.1 " + rCode + " " + rTag + "\r\n");
|
||||||
if (rspheaders != null) {
|
if (rspheaders != null) {
|
||||||
|
@ -314,7 +314,7 @@ public class HttpTransaction {
|
||||||
/* sends one byte less than intended */
|
/* sends one byte less than intended */
|
||||||
|
|
||||||
public void sendPartialResponse (int rCode, String rTag)throws IOException {
|
public void sendPartialResponse (int rCode, String rTag)throws IOException {
|
||||||
OutputStream os = new HttpServer.NioOutputStream(channel(), server.getSSLEngine(), server.outNetBB(), server.outAppBB());
|
OutputStream os = new TestHttpsServer.NioOutputStream(channel(), server.getSSLEngine(), server.outNetBB(), server.outAppBB());
|
||||||
PrintStream ps = new PrintStream (os);
|
PrintStream ps = new PrintStream (os);
|
||||||
ps.print ("HTTP/1.1 " + rCode + " " + rTag + "\r\n");
|
ps.print ("HTTP/1.1 " + rCode + " " + rTag + "\r\n");
|
||||||
ps.flush();
|
ps.flush();
|
||||||
|
|
|
@ -51,7 +51,7 @@ import java.security.*;
|
||||||
* NOTE NOTE NOTE NOTE NOTE NOTE NOTE
|
* NOTE NOTE NOTE NOTE NOTE NOTE NOTE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class HttpServer {
|
public class TestHttpsServer {
|
||||||
|
|
||||||
ServerSocketChannel schan;
|
ServerSocketChannel schan;
|
||||||
int threads;
|
int threads;
|
||||||
|
@ -63,19 +63,19 @@ public class HttpServer {
|
||||||
static SSLContext sslCtx;
|
static SSLContext sslCtx;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a <code>HttpServer<code> instance with the specified callback object
|
* Create a <code>TestHttpsServer<code> instance with the specified callback object
|
||||||
* for handling requests. One thread is created to handle requests,
|
* for handling requests. One thread is created to handle requests,
|
||||||
* and up to ten TCP connections will be handled simultaneously.
|
* and up to ten TCP connections will be handled simultaneously.
|
||||||
* @param cb the callback object which is invoked to handle each
|
* @param cb the callback object which is invoked to handle each
|
||||||
* incoming request
|
* incoming request
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public HttpServer (HttpCallback cb) throws IOException {
|
public TestHttpsServer (HttpCallback cb) throws IOException {
|
||||||
this (cb, 1, 10, 0);
|
this (cb, 1, 10, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a <code>HttpServer<code> instance with the specified number of
|
* Create a <code>TestHttpsServer<code> instance with the specified number of
|
||||||
* threads and maximum number of connections per thread. This functions
|
* threads and maximum number of connections per thread. This functions
|
||||||
* the same as the 4 arg constructor, where the port argument is set to zero.
|
* the same as the 4 arg constructor, where the port argument is set to zero.
|
||||||
* @param cb the callback object which is invoked to handle each
|
* @param cb the callback object which is invoked to handle each
|
||||||
|
@ -86,13 +86,13 @@ public class HttpServer {
|
||||||
* handle per thread
|
* handle per thread
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public HttpServer (HttpCallback cb, int threads, int cperthread)
|
public TestHttpsServer (HttpCallback cb, int threads, int cperthread)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
this (cb, threads, cperthread, 0);
|
this (cb, threads, cperthread, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a <code>HttpServer<code> instance with the specified number
|
* Create a <code>TestHttpsServer<code> instance with the specified number
|
||||||
* of threads and maximum number of connections per thread and running on
|
* of threads and maximum number of connections per thread and running on
|
||||||
* the specified port. The specified number of threads are created to
|
* the specified port. The specified number of threads are created to
|
||||||
* handle incoming requests, and each thread is allowed
|
* handle incoming requests, and each thread is allowed
|
||||||
|
@ -107,7 +107,7 @@ public class HttpServer {
|
||||||
* means choose any free port.
|
* means choose any free port.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public HttpServer (HttpCallback cb, int threads, int cperthread, int port)
|
public TestHttpsServer (HttpCallback cb, int threads, int cperthread, int port)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
schan = ServerSocketChannel.open ();
|
schan = ServerSocketChannel.open ();
|
||||||
InetSocketAddress addr = new InetSocketAddress (port);
|
InetSocketAddress addr = new InetSocketAddress (port);
|
|
@ -25,7 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 6216082
|
* @bug 6216082
|
||||||
* @library ../../../httpstest/
|
* @library ../../../httpstest/
|
||||||
* @build HttpCallback HttpServer ClosedChannelList HttpTransaction TunnelProxy
|
* @build HttpCallback TestHttpsServer ClosedChannelList HttpTransaction TunnelProxy
|
||||||
* @summary Redirect problem with HttpsURLConnection using a proxy
|
* @summary Redirect problem with HttpsURLConnection using a proxy
|
||||||
* SunJSSE does not support dynamic system properties, no way to re-use
|
* SunJSSE does not support dynamic system properties, no way to re-use
|
||||||
* system properties in samevm/agentvm mode.
|
* system properties in samevm/agentvm mode.
|
||||||
|
@ -39,7 +39,7 @@ import java.util.*;
|
||||||
|
|
||||||
public class B6216082 {
|
public class B6216082 {
|
||||||
static SimpleHttpTransaction httpTrans;
|
static SimpleHttpTransaction httpTrans;
|
||||||
static HttpServer server;
|
static TestHttpsServer server;
|
||||||
static TunnelProxy proxy;
|
static TunnelProxy proxy;
|
||||||
|
|
||||||
// it seems there's no proxy ever if a url points to 'localhost',
|
// it seems there's no proxy ever if a url points to 'localhost',
|
||||||
|
@ -133,7 +133,7 @@ public class B6216082 {
|
||||||
// Both the https server and the proxy let the
|
// Both the https server and the proxy let the
|
||||||
// system pick up an ephemeral port.
|
// system pick up an ephemeral port.
|
||||||
httpTrans = new SimpleHttpTransaction();
|
httpTrans = new SimpleHttpTransaction();
|
||||||
server = new HttpServer(httpTrans, 1, 10, 0);
|
server = new TestHttpsServer(httpTrans, 1, 10, 0);
|
||||||
proxy = new TunnelProxy(1, 10, 0);
|
proxy = new TunnelProxy(1, 10, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue