/*
* 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 6306165 6432567
* @summary Check that a bad handshake doesn't cause a debuggee to abort
*
* @build VMConnection BadHandshakeTest Exit0
* @run main BadHandshakeTest
*
*/
public class BadHandshakeTest {
static volatile boolean ready = false;
/*
*/
}
}
public void run() {
try {
byte b[] = new byte[100];
for (;;) {
// The first thing that will get read is
// Listening for transport dt_socket at address: xxxxx
// which shows the debuggee is ready to accept connections.
ready = true;
if (n < 0) {
break;
}
}
} catch (IOException ioe) {
}
}
}
/*
* Find a connector by name
*/
return connector;
}
}
return null;
}
/*
* Launch a server debuggee with the given address
*/
} else {
exe += "java";
}
" -agentlib:jdwp=transport=dt_socket" +
" " + class_name;
return p;
}
/*
* - pick a TCP port
* - Launch a server debuggee: server=y,suspend=y,address=${port}
* - run it to VM death
* - verify we saw no error
*/
// find a free port
// launch the server debuggee
// wait for the debugge to be ready
while (!ready) {
try {
throw ee;
}
}
// Connect to the debuggee and handshake with garbage
s.close();
// Re-connect and to a partial handshake - don't disconnect
// attach to server debuggee and resume it so it can exit
// The first event is always a VMStartEvent, and it is always in
// an EventSet by itself. Wait for it.
if (event instanceof VMStartEvent) {
break;
}
throw new RuntimeException("Test failed - debuggee did not start properly");
}
}
}