/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 6725892
* @summary
*/
public class Test {
static int port;
static boolean failed = false;
throws IOException
{
t.close();
}
}
try {
HttpHandler h = new Handler ();
test1();
test2();
test3();
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException ();
} finally {
}
}
// open TCP connection without sending anything. Check server closes it.
failed = false;
// server should close connection after 2 seconds. We wait up to 10
s.setSoTimeout (10000);
try {
} catch (SocketTimeoutException e) {
failed = true;
}
s.close();
if (failed) {
throw new RuntimeException ();
} else {
}
}
// send request and don't read response. Check server closes connection
// we won't read response and check if it times out
// on server. If it timesout at client then there is a problem
try {
} catch (InterruptedException e) {
throw new RuntimeException ("unexpected error");
} catch (SocketTimeoutException e1) {
throw new RuntimeException ("client timedout");
} finally {
}
}
// same as test2, but repeated with multiple connections
// Worker: a thread opens a connection to the server in one of three modes.
// NORMAL - sends a request, waits for response, and checks valid response
// REQUEST - sends a partial request, and blocks, to see if
// server closes the connection.
// RESPONSE - sends a request, partially reads response and blocks,
// to see if server closes the connection.
enum Mode {
};
}
failed = true;
}
public void run () {
try {
urlc.setDoOutput(true);
} catch (IOException e) {
fail("Worker: failed to connect to server");
return;
}
try {
}
}
fail ("Worker: response");
}
return;
} catch (InterruptedException e0) {
fail("Worker: timedout");
} catch (SocketTimeoutException e1) {
fail("Worker: timedout");
} catch (IOException e2) {
switch (mode) {
case NORMAL:
break;
case RESPONSE:
break;
}
// default: is ok
}
} finally {
}
}
}
failed = false;
for (int i=0; i<NUM; i++) {
}
l.await();
}
if (failed) {
throw new RuntimeException ("test3: failed");
}
}
try {
byte[] buf = new byte [64];
int c;
}
return false;
}
} catch (IOException e) {
return false;
}
return true;
}
}