/** * Start using stream compression since the server has acknowledged stream compression. * * @throws Exception if there is an exception starting stream compression. */ void startStreamCompression() throws Exception { // Secure the plain connection usingCompression = true; // Initialize the reader and writer with the new secured version initReaderAndWriter(); // Set the new writer to use packetWriter.setWriter(writer); // Send a new opening stream to the server packetWriter.openStream(); // Notify that compression is being used synchronized (this) { this.notify(); } }
/** * The server has indicated that TLS negotiation can start. We now need to secure the existing * plain connection and perform a handshake. This method won't return until the connection has * finished the handshake or an error occured while securing the connection. * * @throws Exception if an exception occurs. */ void proceedTLSReceived() throws Exception { enableEncryption(true); // Initialize the reader and writer with the new secured version initReaderAndWriter(); // Proceed to do the handshake ((SSLSocket) socket).startHandshake(); // if (((SSLSocket) socket).getWantClientAuth()) { // System.err.println("Connection wants client auth"); // } // else if (((SSLSocket) socket).getNeedClientAuth()) { // System.err.println("Connection needs client auth"); // } // else { // System.err.println("Connection does not require client auth"); // } // Set that TLS was successful usingTLS = true; // Set the new writer to use packetWriter.setWriter(writer); // Send a new opening stream to the server packetWriter.openStream(); }