private void handleWrapOverflow() {
    int currentNetWriteBufferSize = netWriteBufferSize();
    netWriteBuffer.compact();
    netWriteBuffer = Utils.ensureCapacity(netWriteBuffer, currentNetWriteBufferSize);
    netWriteBuffer.flip();
    if (netWriteBuffer.limit() >= currentNetWriteBufferSize) {
      throw new IllegalStateException(
          "Buffer overflow when available data size (" + netWriteBuffer.limit() + ") >= network buffer size ("
              + currentNetWriteBufferSize + ")");
    }
  }
Increase the size of {@link #netWriteBuffer}. To be called when a wrap call returns {@link Status#BUFFER_OVERFLOW}.
ambry-network/src/main/java/com/github/ambry/network/SSLTransmission.java