/*
* 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 5054016
* @summary get the failure immediately when writing individual chunks over socket fail
*/
public class checkError {
static int j = 0;
synchronized(threadWaiting) {
synchronized(threadStarting) {
server = new HTTPServer();
try {
} catch (InterruptedException e) {
}
}
conn.setDoOutput(true);
}
int byteAtOnce = 0;
int sendingBytes = totalBytes;
try {
while (sendingBytes > 0) {
if (sendingBytes > bufferSize) {
} else {
}
// System.out.println((totalBytes - sendingBytes) + " was sent");
}
} catch (OutOfMemoryError e) {
e.printStackTrace();
testExit();
} catch (IOException e) {
// e.printStackTrace();
// this is the expected IOException
// due to server.close()
testExit();
} finally {
}
// we have not received the expected IOException
// test fail
testExit();
}
static void testExit() {
if (testStatus == TEST_FAILED) {
throw new RuntimeException("Test Failed: haven't received the expected IOException");
} else {
}
}
for (int i = 0; i < size; i++) {
if (j > 9)
j = 0;
j++;
}
return buffer;
}
}
static volatile boolean isCompleted;
int getPort() {
return serverSocket.getLocalPort();
}
public void run() {
synchronized(checkError.threadStarting) {
try {
} catch (Exception e) {
e.printStackTrace();
return;
}
}
try {
} catch (Exception e) {
e.printStackTrace();
return;
}
synchronized(checkError.threadWaiting) {
try {
} catch (Exception e) {
e.printStackTrace();
return;
}
// save version for replies
}
try {
}
} catch (IOException e) {
e.printStackTrace();
return;
}
byte[] buf = new byte[1024];
try {
//reading bytes until chunk whose size is zero,
// see 19.4.6 Introduction of Transfer-Encoding in RFC2616
int count = 0;
while (count <=5) {
count++;
}
} catch (IOException e) {
e.printStackTrace();
return;
} catch (OutOfMemoryError e) {
e.printStackTrace();
return;
}
}
}
}