public void thresholdNotReached() throws IOException {
//Send single message if didn't send any message yet or end message if already send message
if (messageSent) {
SoapTcpFrameHeader header = new SoapTcpFrameHeader(SoapTcpFrameHeader.MESSAGE_END_CHUNK, null);
header.setChannelId(channelId);
SoapTcpFrame frame = new SoapTcpFrame();
frame.setChannelId(channelId);
frame.setHeader(header);
frame.setPayload(this.buffer.toByteArray());
SoapTcpUtils.writeMessageFrame(outStream, frame);
} else {
final SoapTcpFrameContentDescription contentDesc = new SoapTcpFrameContentDescription();
contentDesc.setContentId(0);
final Map<Integer, String> parameters = new Hashtable<Integer, String>();
parameters.put(0, "utf-8");
contentDesc.setParameters(parameters);
final SoapTcpFrameHeader header =
new SoapTcpFrameHeader(SoapTcpFrameHeader.SINGLE_FRAME_MESSAGE, contentDesc);
header.setChannelId(channelId);
final SoapTcpFrame frame = new SoapTcpFrame();
frame.setHeader(header);
frame.setChannelId(channelId);
frame.setPayload(this.buffer.toByteArray());
SoapTcpUtils.writeMessageFrame(outStream, frame);
messageSent = true;
}
}