diff --git a/tcp/src/main/java/org/jivesoftware/smack/PacketReader.java b/tcp/src/main/java/org/jivesoftware/smack/PacketReader.java index 3b57754e4..648041f60 100644 --- a/tcp/src/main/java/org/jivesoftware/smack/PacketReader.java +++ b/tcp/src/main/java/org/jivesoftware/smack/PacketReader.java @@ -231,7 +231,7 @@ class PacketReader { // Stream compression has been denied. This is a recoverable // situation. It is still possible to authenticate and // use the connection but using an uncompressed connection - connection.streamCompressionDenied(); + connection.streamCompressionNegotiationDone(); } else { // SASL authentication has failed. The server may close the connection diff --git a/tcp/src/main/java/org/jivesoftware/smack/XMPPTCPConnection.java b/tcp/src/main/java/org/jivesoftware/smack/XMPPTCPConnection.java index 91d8e3e63..dcad1efa3 100644 --- a/tcp/src/main/java/org/jivesoftware/smack/XMPPTCPConnection.java +++ b/tcp/src/main/java/org/jivesoftware/smack/XMPPTCPConnection.java @@ -776,8 +776,9 @@ public class XMPPTCPConnection extends XMPPConnection { *
*
* @return true if stream compression negotiation was successful.
+ * @throws IOException if the compress stanza could not be send
*/
- private boolean useCompression() {
+ private boolean useCompression() throws IOException {
// If stream compression was offered by the server and we want to use
// compression then send compression request to the server
if (authenticated) {
@@ -785,9 +786,9 @@ public class XMPPTCPConnection extends XMPPConnection {
}
if ((compressionHandler = maybeGetCompressionHandler()) != null) {
- requestStreamCompression(compressionHandler.getCompressionMethod());
- // Wait until compression is being used or a timeout happened
synchronized (this) {
+ requestStreamCompression(compressionHandler.getCompressionMethod());
+ // Wait until compression is being used or a timeout happened
try {
wait(getPacketReplyTimeout());
}
@@ -804,24 +805,20 @@ public class XMPPTCPConnection extends XMPPConnection {
* Request the server that we want to start using stream compression. When using TLS
* then negotiation of stream compression can only happen after TLS was negotiated. If TLS
* compression is being used the stream compression should not be used.
+ * @throws IOException if the compress stanza could not be send
*/
- private void requestStreamCompression(String method) {
- try {
- writer.write("