public void wrap(ByteBuffer app, ByteBuffer net) throws SSLException {
        tlsEngineResult = tlsEngine.wrap(app, net);
        log("server wrap: ", tlsEngineResult);
        if (tlsEngineResult.getHandshakeStatus() == HandshakeStatus.NEED_TASK) {
            // If the result indicates that we have outstanding tasks to do, go
            // ahead and run them in this thread.
            doTasks();
        }
    }
Attempts to encode a buffer of plaintext application data into TLS network data. Depending on
the state of the TLSWrapper, this method may produce network data without consuming any
application data (for example, it may generate handshake data).

If this TLSWrapper has not yet started its initial handshake, this method will automatically
start the handshake.

@param app a ByteBuffer containing outbound application data
@param net a ByteBuffer to hold outbound network data
@throws SSLException A problem was encountered while processing the data that caused the
            TLSWrapper to abort.
xmppserver/src/main/java/org/jivesoftware/openfire/net/TLSWrapper.java