private void writeHeader(final Channel channel) throws IOException {
CancellableDataOutputStream dos = new CancellableDataOutputStream(channel.writeMessage());
try {
dos.writeBytes("JMX");
byte[] versions = Versions.getSupportedVersions();
dos.writeInt(versions.length);
dos.write(versions);
if (Version.isSnapshot()) {
dos.write(SNAPSHOT);
} else {
dos.write(STABLE);