@Override
public void send(ByteBuffer buf)
{
if (closed.get())
{
throw new SenderException("SSL Sender is closed");
}
if (isSecurityLayerEstablished())
{
while (buf.hasRemaining())
{
int length = Math.min(buf.remaining(),sendBuffSize);
log.debug("sendBuffSize %s", sendBuffSize);
log.debug("buf.remaining() %s", buf.remaining());
buf.get(appData, 0, length);
try
{
byte[] out = saslClient.wrap(appData, 0, length);
log.debug("out.length %s", out.length);
delegate.send(ByteBuffer.wrap(out));
}
catch (SaslException e)
{
log.error("Exception while encrypting data.",e);
throw new SenderException("SASL Sender, Error occurred while encrypting data",e);
}
}
}
else
{