/*
* 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.
*/
/*
* @bug 4517622
* @summary SocketException on first read after error; -1 on subsequent reads
*/
public class Test {
// test server that cycles through each combination of response
}
public void run() {
int testCombination = 0;
try {
for (;;) {
switch (testCombination) {
case 0:
s.setTcpNoDelay(false);
s.setSoLinger(true, 0);
break;
case 1:
s.setTcpNoDelay(true);
s.setSoLinger(true, 0);
break;
case 2:
s.setSoLinger(true, 0);
break;
case 3:
break; /* EOF test */
case 4:
break;
}
s.close();
}
} catch (IOException ioe) {
}
}
}
public int getPort() {
return ss.getLocalPort();
}
public void shutdown() {
try {
} catch (IOException ioe) { }
}
}
byte b[] = new byte[50];
int state = STATE_DATA;
boolean failed = false;
for (int i=0; i<200; i++) {
case 0:
try {
} catch (IOException ioe) { }
break;
case 1:
try {
int n = s.getInputStream().available();
// available should never return > 0 if read
// has already thrown IOE or returned EOF
" (unexpected as IOE or EOF already received)");
failed = true;
}
} catch (IOException ioe) {
failed = true;
}
break;
case 2:
try {
int n = s.getInputStream().read(b);
" (unexpected as IOE already thrown)");
failed = true;
}
" (unexpected as EOF already received)");
failed = true;
}
if (n < 0) {
" (unexpected as IOE already thrown)");
failed = true;
}
}
}
} catch (IOException ioe) {
" (unexpected as EOF already received)");
failed = true;
}
}
}
break;
case 3:
try {
}
if (failed) {
failures++;
break;
}
}
s.close();
}
// server mode only
return;
}
}
// run standalone or connect to remote server
} else {
}
for (int i=0; i<10; i++) {
}
}
if (failures > 0) {
}
}
}