buffer.flip();
while (buffer.hasRemaining()) {
try {
channel.write(buffer);
} catch (IOException e) {
throw new CommunicationException("Can't connect to tarantool", e);
}
}
try {
ByteBuffer version = ByteBuffer.allocate(4).order(ByteOrder.LITTLE_ENDIAN);
readFullyAndFlip(version);
int v = version.getInt();
if (v != Const.VERSION) {
throw new CommunicationException("Server version " + v + " is not supported");
}
} catch (IOException e) {
throw new CommunicationException("Can't get version", e);
}
}