* @see com.sun.jdi.connect.spi.Connection#writePacket(byte[])
*/
@Override
public void writePacket(byte[] packet) throws IOException {
if (!isOpen()) {
throw new ClosedConnectionException();
}
if (packet == null) {
throw new IllegalArgumentException(
"Invalid JDWP Packet, packet cannot be null"); //$NON-NLS-1$
}
if (packet.length < 11) {
throw new IllegalArgumentException(
"Invalid JDWP Packet, must be at least 11 bytes. PacketSize:" + packet.length); //$NON-NLS-1$
}
int packetSize = getPacketLength(packet);
if (packetSize < 11) {
throw new IllegalArgumentException(
"Invalid JDWP Packet, must be at least 11 bytes. PacketSize:" + packetSize); //$NON-NLS-1$
}
if (packetSize > packet.length) {
throw new IllegalArgumentException(
"Invalid JDWP packet: Specified length is greater than actual length"); //$NON-NLS-1$
}
OutputStream stream = null;
synchronized (this) {
if (!isOpen()) {
throw new ClosedConnectionException();
}
stream = fTransport.getOutputStream();
}
synchronized (stream) {