/** * Returns {@code true} if the given {@link ChannelBuffer} is encrypted. Be aware that this method * will not increase the readerIndex of the given {@link ChannelBuffer}. * * @param buffer * The {@link ChannelBuffer} to read from. Be aware that it must have at least 5 bytes to read, * otherwise it will throw an {@link IllegalArgumentException}. * @return encrypted * {@code true} if the {@link ChannelBuffer} is encrypted, {@code false} otherwise. * @throws IllegalArgumentException * Is thrown if the given {@link ChannelBuffer} has not at least 5 bytes to read. */ public static boolean isEncrypted(ChannelBuffer buffer) { return getEncryptedPacketLength(buffer, buffer.readerIndex()) != -1; }
final int packetLength = getEncryptedPacketLength(in, offset); if (packetLength == -1) { nonSslRecord = true;