int updateAndGet(int actualSize, boolean update) {
                int size = actualSize;
                if (bufSizeOverride != null) {
                    if (update)
                        bufSizeOverride = Math.min(bufSizeOverride * 2, size);
                    size = bufSizeOverride;
                }
                return size;
            }
SSLTransportLayer with overrides for testing including:
<ul>
<li>Overrides for packet and application buffer size to test buffer resize code path.
The overridden buffer size starts with a small value and increases in size when the buffer size
is retrieved to handle overflow/underflow, until the actual session buffer size is reached.</li>
<li>IOException injection for reads and writes for testing exception handling during handshakes.</li>
<li>Delayed writes to test handshake failure notifications to peer</li>
</ul>
clients/src/test/java/org/apache/kafka/common/network/SslTransportLayerTest.java