try{
TFramedTransport.encodeFrameSize( messageLength, bytes );
bos.setWriteIndex( MESSAGE_LENGTH_INDEX );
protocol.writeI32( messageLength );
bos.setWriteIndex( MESSAGE_HEADER_LENGTH_INDEX );
protocol.writeI16( ( short ) ( 0xffff & headerLength ) );
} finally {
bos.setWriteIndex( oldIndex );
}
} catch ( TException e ) {