fix for: https://issues.apache.org/jira/browse/AMQ-2583 - nio+ssl initial implementation, don't flip the buffer when its just a plain buffer without SSLEngine wrapping as it result in setting the buffer position and limit to zero since that's where its position is already. This fixes the failing Stomp NIO tests.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1149672 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2011-07-22 18:02:32 +00:00
parent fd37c9f968
commit c78c2449cb
1 changed files with 11 additions and 15 deletions

View File

@ -26,14 +26,10 @@ import java.nio.channels.WritableByteChannel;
import org.apache.activemq.transport.tcp.TimeStampStream;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLEngineResult;
/**
* An optimized buffered outputstream for Tcp
*
*
*/
public class NIOOutputStream extends OutputStream implements TimeStampStream {
private static final int BUFFER_SIZE = 8192;
@ -159,10 +155,10 @@ public class NIOOutputStream extends OutputStream implements TimeStampStream {
plain = ByteBuffer.allocate(engine.getSession().getPacketBufferSize());
plain.clear();
engine.wrap(data, plain);
plain.flip();
} else {
plain = data;
}
plain.flip();
int remaining = plain.remaining();
int lastRemaining = remaining - 1;
long delay = 1;