// Path: influent-transport/src/main/java/influent/exception/InfluentIOException.java
// public final class InfluentIOException extends RuntimeException {
//   /**
//    * Constructs a new {@code InfluentIOException}.
//    *
//    * @param message the error message
//    * @param cause the cause
//    */
//   public InfluentIOException(final String message, final Throwable cause) {
//     super(message, cause);
//   }
// 
//   /**
//    * Constructs a new {@code InfluentIOException}.
//    *
//    * @param message the error message
//    */
//   public InfluentIOException(final String message) {
//     super(message);
//   }
// 
//   /** Constructs a new {@code InfluentIOException}. */
//   public InfluentIOException() {
//     super();
//   }
// }
// 
// Path: influent-transport/src/main/java/influent/internal/nio/NioTcpChannel.java
// public interface NioTcpChannel extends AutoCloseable {
//   enum Op {
//     /** OP_READ */
//     READ(SelectionKey.OP_READ),
//     /** OP_WRITE */
//     WRITE(SelectionKey.OP_WRITE);
// 
//     private final int bit;
// 
//     Op(final int bit) {
//       this.bit = bit;
//     }
// 
//     int getBit() {
//       return bit;
//     }
// 
//     static int bits(final Set<Op> ops) {
//       return ops.stream().mapToInt(Op::getBit).reduce(0, (x, y) -> x | y);
//     }
//   }
// 
//   /**
//    * Writes bytes to the socket buffer.
//    *
//    * <p>This method is not guaranteed to be thread-safe.
//    *
//    * @param src the buffer
//    * @return true when some bytes are written
//    * @throws InfluentIOException if some IO error occurs
//    */
//   boolean write(final ByteBuffer src);
// 
//   /**
//    * Reads bytes from the socket buffer.
//    *
//    * <p>This method is not guaranteed to be thread-safe.
//    *
//    * @param dst the buffer
//    * @return true when some bytes are read
//    * @throws InfluentIOException if some IO error occurs
//    */
//   boolean read(final ByteBuffer dst);
// 
//   /**
//    * Registers the this channel to the given {@code NioEventLoop}.
//    *
//    * <p>This method is thread-safe.
//    *
//    * @param ops the operations to be enabled
//    * @param attachment the {@code NioAttachment}
//    */
//   void register(final Set<Op> ops, final NioAttachment attachment);
// 
//   /**
//    * Enables the given operation.
//    *
//    * <p>This method is thread-safe and operations are done asynchronously.
//    *
//    * @param op the operation to be enabled
//    */
//   void enable(final Op op);
// 
//   /**
//    * Disables the given operation.
//    *
//    * <p>This method is thread-safe and operations are done asynchronously.
//    *
//    * @param op the operation to be disabled
//    */
//   void disable(final Op op);
// 
//   /**
//    * Closes the {@code SocketChannel}.
//    *
//    * <p>This method is not guaranteed to be thread-safe.
//    */
//   @Override
//   void close();
// 
//   /**
//    * Returns true if this channel is open
//    *
//    * <p>This method is not guaranteed to be thread-safe.
//    */
//   boolean isOpen();
// 
//   /**
//    * Returns the remote address
//    *
//    * <p>This method is thread-safe.
//    */
//   SocketAddress getRemoteAddress();
// }


import java.nio.ByteBuffer;
import java.util.LinkedList;
import java.util.NoSuchElementException;
import java.util.Queue;
import java.util.function.Supplier;
import org.msgpack.value.ImmutableValue;
import influent.exception.InfluentIOException;
import influent.internal.nio.NioTcpChannel;
        } else if (currentChunkSize >= chunkSizeLimit) {
          channel.close();
          throw new InfluentIOException(
              "The chunk size exceeds the limit. size = "
                  + buffer.remaining()
                  + ", limit = "
                  + chunkSizeLimit);
        } else {
          currentUnpacker = result.next();
          break;
        }
      } catch (final InfluentIOException e) {
        throw e;
      } catch (final Exception e) {
        channel.close();
        throw new InfluentIOException("Failed unpacking.", e);
      }
    }
  }

  /** @return true if this {@code MsgpackStreamUnpacker} can return the next value */
  public boolean hasNext() {
    return !unpackedValues.isEmpty();
  }

  /**
   * @return the next {@code ImmutableValue}
   * @throws NoSuchElementException when no next value is found
   */
  public ImmutableValue next() {
// Path: influent-transport/src/main/java/influent/exception/InfluentIOException.java
// public final class InfluentIOException extends RuntimeException {
//   /**
//    * Constructs a new {@code InfluentIOException}.
//    *
//    * @param message the error message
//    * @param cause the cause
//    */
//   public InfluentIOException(final String message, final Throwable cause) {
//     super(message, cause);
//   }
// 
//   /**
//    * Constructs a new {@code InfluentIOException}.
//    *
//    * @param message the error message
//    */
//   public InfluentIOException(final String message) {
//     super(message);
//   }
// 
//   /** Constructs a new {@code InfluentIOException}. */
//   public InfluentIOException() {
//     super();
//   }
// }
// 
// Path: influent-transport/src/main/java/influent/internal/nio/NioTcpChannel.java
// public interface NioTcpChannel extends AutoCloseable {
//   enum Op {
//     /** OP_READ */
//     READ(SelectionKey.OP_READ),
//     /** OP_WRITE */
//     WRITE(SelectionKey.OP_WRITE);
// 
//     private final int bit;
// 
//     Op(final int bit) {
//       this.bit = bit;
//     }
// 
//     int getBit() {
//       return bit;
//     }
// 
//     static int bits(final Set<Op> ops) {
//       return ops.stream().mapToInt(Op::getBit).reduce(0, (x, y) -> x | y);
//     }
//   }
// 
//   /**
//    * Writes bytes to the socket buffer.
//    *
//    * <p>This method is not guaranteed to be thread-safe.
//    *
//    * @param src the buffer
//    * @return true when some bytes are written
//    * @throws InfluentIOException if some IO error occurs
//    */
//   boolean write(final ByteBuffer src);
// 
//   /**
//    * Reads bytes from the socket buffer.
//    *
//    * <p>This method is not guaranteed to be thread-safe.
//    *
//    * @param dst the buffer
//    * @return true when some bytes are read
//    * @throws InfluentIOException if some IO error occurs
//    */
//   boolean read(final ByteBuffer dst);
// 
//   /**
//    * Registers the this channel to the given {@code NioEventLoop}.
//    *
//    * <p>This method is thread-safe.
//    *
//    * @param ops the operations to be enabled
//    * @param attachment the {@code NioAttachment}
//    */
//   void register(final Set<Op> ops, final NioAttachment attachment);
// 
//   /**
//    * Enables the given operation.
//    *
//    * <p>This method is thread-safe and operations are done asynchronously.
//    *
//    * @param op the operation to be enabled
//    */
//   void enable(final Op op);
// 
//   /**
//    * Disables the given operation.
//    *
//    * <p>This method is thread-safe and operations are done asynchronously.
//    *
//    * @param op the operation to be disabled
//    */
//   void disable(final Op op);
// 
//   /**
//    * Closes the {@code SocketChannel}.
//    *
//    * <p>This method is not guaranteed to be thread-safe.
//    */
//   @Override
//   void close();
// 
//   /**
//    * Returns true if this channel is open
//    *
//    * <p>This method is not guaranteed to be thread-safe.
//    */
//   boolean isOpen();
// 
//   /**
//    * Returns the remote address
//    *
//    * <p>This method is thread-safe.
//    */
//   SocketAddress getRemoteAddress();
// }


// Path: influent-java/src/main/java/influent/internal/msgpack/MsgpackStreamUnpacker.java
import java.nio.ByteBuffer;
import java.util.LinkedList;
import java.util.NoSuchElementException;
import java.util.Queue;
import java.util.function.Supplier;
import org.msgpack.value.ImmutableValue;
import influent.exception.InfluentIOException;
import influent.internal.nio.NioTcpChannel;

        } else if (currentChunkSize >= chunkSizeLimit) {
          channel.close();
          throw new InfluentIOException(
              "The chunk size exceeds the limit. size = "
                  + buffer.remaining()
                  + ", limit = "
                  + chunkSizeLimit);
        } else {
          currentUnpacker = result.next();
          break;
        }
      } catch (final InfluentIOException e) {
        throw e;
      } catch (final Exception e) {
        channel.close();
        throw new InfluentIOException("Failed unpacking.", e);
      }
    }
  }

  /** @return true if this {@code MsgpackStreamUnpacker} can return the next value */
  public boolean hasNext() {
    return !unpackedValues.isEmpty();
  }

  /**
   * @return the next {@code ImmutableValue}
   * @throws NoSuchElementException when no next value is found
   */
  public ImmutableValue next() {
    return unpackedValues.remove();