Ah, thank you for the clarification, having japicmp will help avoid these types of issues in the future :-)
Gary On Tue, Mar 15, 2022, 09:58 Emmanuel Lécharny <[email protected]> wrote: > Hi Gary, > > this is a working branch in which some classes have been renamed from > SslXXX to SSLXXX, and this commit is moving back to the previous names, > exactly for the reason you mention... > > So I guess you will approve this comit :-) > > On 15/03/2022 14:41, Gary Gregory wrote: > > You can't rename public or protected classes/types/methods without > breaking > > existing applications! > > > > Gary > > > > Gary > > > > On Tue, Mar 15, 2022, 09:31 <[email protected]> wrote: > > > >> This is an automated email from the ASF dual-hosted git repository. > >> > >> elecharny pushed a commit to branch 2.2.X > >> in repository https://gitbox.apache.org/repos/asf/mina.git > >> > >> commit f64544006e9714541e1b472cef5be58148a3fd01 > >> Author: emmanuel lecharny <[email protected]> > >> AuthorDate: Tue Mar 15 14:31:41 2022 +0100 > >> > >> o Renamed SSLxxx classes to Sslxxx to keep an ascendant > compatibility > >> o Used meaningful variable nales > >> o Removed useless 'this' > >> o Removed useless 'final' > >> o Transmitted the nexwt filter to the throw_pending_error() method > in > >> order to be able to write back the Alert to the remote peer > >> o Write the Alter back to the remote peer in the receive_loop() > method > >> when the inbound has been closed following an error while processing a > task > >> o Quick exit the receive_loop() method if the read message is empty > >> o Minor formatting (added nl, etc) > >> o Added missing javadoc > >> --- > >> .../org/apache/mina/filter/ssl/SSLHandlerG0.java | 381 > >> ++++++++++++++------- > >> ...LContextFactory.java => SslContextFactory.java} | 2 +- > >> .../filter/ssl/{SSLEvent.java => SslEvent.java} | 2 +- > >> .../filter/ssl/{SSLFilter.java => SslFilter.java} | 30 +- > >> .../ssl/{SSLHandler.java => SslHandler.java} | 6 +- > >> .../transport/socket/nio/NioSocketSession.java | 4 +- > >> .../SSLTestHandshakeExceptionDIRMINA1077Test.java | 6 +- > >> .../ssl/{SSLFilterMain.java => SslFilterMain.java} | 8 +- > >> .../java/org/apache/mina/example/chat/Main.java | 4 +- > >> .../example/chat/client/ChatClientSupport.java | 4 +- > >> .../org/apache/mina/example/echoserver/Main.java | 4 +- > >> .../apache/mina/example/tcp/perf/TcpSslClient.java | 4 +- > >> .../apache/mina/example/tcp/perf/TcpSslServer.java | 4 +- > >> .../org/apache/mina/example/chat/serverContext.xml | 4 +- > >> .../mina/example/echoserver/AbstractTest.java | 4 +- > >> .../mina/example/echoserver/ConnectorTest.java | 10 +- > >> .../ssl/{SSLFilterTest.java => SslFilterTest.java} | 8 +- > >> 17 files changed, 304 insertions(+), 181 deletions(-) > >> > >> diff --git > >> a/mina-core/src/main/java/org/apache/mina/filter/ssl/SSLHandlerG0.java > >> b/mina-core/src/main/java/org/apache/mina/filter/ssl/SSLHandlerG0.java > >> index 76f2d53..31c35f5 100644 > >> --- > a/mina-core/src/main/java/org/apache/mina/filter/ssl/SSLHandlerG0.java > >> +++ > b/mina-core/src/main/java/org/apache/mina/filter/ssl/SSLHandlerG0.java > >> @@ -42,7 +42,7 @@ import org.apache.mina.core.write.WriteRequest; > >> * @author Jonathan Valliere > >> * @author <a href="http://mina.apache.org">Apache MINA Project</a> > >> */ > >> -public class SSLHandlerG0 extends SSLHandler { > >> +public class SSLHandlerG0 extends SslHandler { > >> > >> /** > >> * Maximum number of queued messages waiting for encoding > >> @@ -102,12 +102,12 @@ public class SSLHandlerG0 extends SSLHandler { > >> /** > >> * Instantiates a new handler > >> * > >> - * @param p engine > >> - * @param e executor > >> - * @param s session > >> + * @param sslEngine The SSLEngine instance > >> + * @param executor The executor instance to use to process tasks > >> + * @param session The session to handle > >> */ > >> - public SSLHandlerG0(SSLEngine p, Executor e, IoSession s) { > >> - super(p, e, s); > >> + public SSLHandlerG0(SSLEngine sslEngine, Executor executor, > IoSession > >> session) { > >> + super(sslEngine, executor, session); > >> } > >> > >> /** > >> @@ -115,7 +115,7 @@ public class SSLHandlerG0 extends SSLHandler { > >> */ > >> @Override > >> public boolean isOpen() { > >> - return this.mEngine.isOutboundDone() == false; > >> + return mEngine.isOutboundDone() == false; > >> } > >> > >> /** > >> @@ -123,21 +123,24 @@ public class SSLHandlerG0 extends SSLHandler { > >> */ > >> @Override > >> public boolean isConnected() { > >> - return this.mHandshakeComplete && isOpen(); > >> + return mHandshakeComplete && isOpen(); > >> } > >> > >> /** > >> * {@inheritDoc} > >> */ > >> - synchronized public void open(final NextFilter next) throws > >> SSLException { > >> - if (this.mHandshakeStarted == false) { > >> - this.mHandshakeStarted = true; > >> - if (this.mEngine.getUseClientMode()) { > >> + @Override > >> + synchronized public void open(NextFilter next) throws SSLException > { > >> + if (mHandshakeStarted == false) { > >> + mHandshakeStarted = true; > >> + > >> + if (mEngine.getUseClientMode()) { > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} open() - begin handshaking", > >> toString()); > >> } > >> - this.mEngine.beginHandshake(); > >> - this.write_handshake(next); > >> + > >> + mEngine.beginHandshake(); > >> + write_handshake(next); > >> } > >> } > >> } > >> @@ -145,51 +148,75 @@ public class SSLHandlerG0 extends SSLHandler { > >> /** > >> * {@inheritDoc} > >> */ > >> - synchronized public void receive(final NextFilter next, final > >> IoBuffer message) throws SSLException { > >> - if (this.mDecodeThread == null) { > >> + @Override > >> + synchronized public void receive(NextFilter next, IoBuffer message) > >> throws SSLException { > >> + if (mDecodeThread == null) { > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} receive() - message {}", toString(), > >> message); > >> } > >> - this.mDecodeThread = Thread.currentThread(); > >> - final IoBuffer source = resume_decode_buffer(message); > >> + > >> + mDecodeThread = Thread.currentThread(); > >> + IoBuffer source = resume_decode_buffer(message); > >> + > >> try { > >> - this.receive_loop(next, source); > >> + receive_loop(next, source); > >> } finally { > >> suspend_decode_buffer(source); > >> - this.mDecodeThread = null; > >> + mDecodeThread = null; > >> } > >> } else { > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} receive() - recursion", toString()); > >> } > >> - this.receive_loop(next, this.mDecodeBuffer); > >> + > >> + receive_loop(next, mDecodeBuffer); > >> } > >> > >> - this.throw_pending_error(); > >> + throw_pending_error(next); > >> } > >> > >> /** > >> * Process a received message > >> * > >> - * @param next > >> - * @param message > >> + * @param next The next filter > >> + * @param message The message to process > >> * > >> - * @throws SSLException > >> + * @throws SSLException If we get some error while processing the > >> message > >> */ > >> @SuppressWarnings("incomplete-switch") > >> - protected void receive_loop(final NextFilter next, final IoBuffer > >> message) throws SSLException { > >> + protected void receive_loop(NextFilter next, IoBuffer message) > throws > >> SSLException { > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} receive_loop() - source {}", toString(), > >> message); > >> } > >> > >> if (mEngine.isInboundDone()) { > >> - throw new IllegalStateException("closed"); > >> + switch (mEngine.getHandshakeStatus()) { > >> + case NEED_WRAP: > >> + if (LOGGER.isDebugEnabled()) { > >> + LOGGER.debug("{} receive_loop() - handshake > needs > >> wrap, invoking write", toString()); > >> + } > >> + > >> + write_handshake(next); > >> + break; > >> + } > >> + > >> + if ( mPendingError != null ) { > >> + throw mPendingError; > >> + } else { > >> + throw new IllegalStateException("closed"); > >> + } > >> } > >> > >> - final IoBuffer source = message; > >> - final IoBuffer dest = allocate_app_buffer(source.remaining()); > >> + IoBuffer source = message; > >> + > >> + // No need to fo for another loop if the message is empty > >> + if (source.remaining() == 0) { > >> + return; > >> + } > >> + > >> + IoBuffer dest = allocate_app_buffer(source.remaining()); > >> > >> - final SSLEngineResult result = mEngine.unwrap(source.buf(), > >> dest.buf()); > >> + SSLEngineResult result = mEngine.unwrap(source.buf(), > dest.buf()); > >> > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} receive_loop() - bytes-consumed {}, > >> bytes-produced {}, status {}, handshake {}", > >> @@ -201,10 +228,12 @@ public class SSLHandlerG0 extends SSLHandler { > >> dest.free(); > >> } else { > >> dest.flip(); > >> + > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} receive_loop() - result {}", > toString(), > >> dest); > >> } > >> - next.messageReceived(this.mSession, dest); > >> + > >> + next.messageReceived(mSession, dest); > >> } > >> > >> switch (result.getHandshakeStatus()) { > >> @@ -213,34 +242,44 @@ public class SSLHandlerG0 extends SSLHandler { > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} receive_loop() - handshake > needs > >> unwrap, looping", toString()); > >> } > >> - this.receive_loop(next, message); > >> + > >> + receive_loop(next, message); > >> } > >> + > >> break; > >> case NEED_TASK: > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} receive_loop() - handshake needs > >> task, scheduling", toString()); > >> } > >> - this.schedule_task(next); > >> + > >> + execute_task(next); > >> + > >> break; > >> case NEED_WRAP: > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} receive_loop() - handshake needs > >> wrap, invoking write", toString()); > >> } > >> - this.write_handshake(next); > >> + > >> + write_handshake(next); > >> break; > >> + > >> case FINISHED: > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} receive_loop() - handshake > finished, > >> flushing queue", toString()); > >> } > >> - this.finish_handshake(next); > >> + > >> + finish_handshake(next); > >> break; > >> + > >> case NOT_HANDSHAKING: > >> if ((result.bytesProduced() != 0 || > >> result.bytesConsumed() != 0) && message.hasRemaining()) { > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} receive_loop() - trying to > >> decode more messages, looping", toString()); > >> } > >> - this.receive_loop(next, message); > >> + > >> + receive_loop(next, message); > >> } > >> + > >> break; > >> } > >> } > >> @@ -248,55 +287,62 @@ public class SSLHandlerG0 extends SSLHandler { > >> /** > >> * {@inheritDoc} > >> */ > >> - synchronized public void ack(final NextFilter next, final > >> WriteRequest request) throws SSLException { > >> - if (this.mAckQueue.remove(request)) { > >> + @Override > >> + synchronized public void ack(NextFilter next, WriteRequest request) > >> throws SSLException { > >> + if (mAckQueue.remove(request)) { > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} ack() - {}", toString(), request); > >> } > >> + > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} ack() - checking to see if any > messages > >> can be flushed", toString(), request); > >> } > >> - this.flush(next); > >> + > >> + flush(next); > >> } > >> > >> - this.throw_pending_error(); > >> + throw_pending_error(next); > >> } > >> > >> /** > >> * {@inheritDoc} > >> */ > >> - synchronized public void write(final NextFilter next, final > >> WriteRequest request) > >> - throws SSLException, WriteRejectedException { > >> + @Override > >> + synchronized public void write(NextFilter next, WriteRequest > request) > >> throws SSLException, WriteRejectedException { > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} write() - source {}", toString(), > request); > >> } > >> > >> - if (this.mOutboundClosing) { > >> + if (mOutboundClosing) { > >> throw new WriteRejectedException(request, "closing"); > >> } > >> > >> - if (this.mEncodeQueue.isEmpty()) { > >> - if (this.write_user_loop(next, request) == false) { > >> + if (mEncodeQueue.isEmpty()) { > >> + if (write_user_loop(next, request) == false) { > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} write() - unable to write right > now, > >> saving request for later", toString(), > >> request); > >> } > >> - if (this.mEncodeQueue.size() == MAX_QUEUED_MESSAGES) { > >> + > >> + if (mEncodeQueue.size() == MAX_QUEUED_MESSAGES) { > >> throw new BufferOverflowException(); > >> } > >> - this.mEncodeQueue.add(request); > >> + > >> + mEncodeQueue.add(request); > >> } > >> } else { > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} write() - unable to write right now, > >> saving request for later", toString(), request); > >> } > >> - if (this.mEncodeQueue.size() == MAX_QUEUED_MESSAGES) { > >> + > >> + if (mEncodeQueue.size() == MAX_QUEUED_MESSAGES) { > >> throw new BufferOverflowException(); > >> } > >> - this.mEncodeQueue.add(request); > >> + > >> + mEncodeQueue.add(request); > >> } > >> > >> - this.throw_pending_error(); > >> + throw_pending_error(next); > >> } > >> > >> /** > >> @@ -311,16 +357,15 @@ public class SSLHandlerG0 extends SSLHandler { > >> * @throws SSLException > >> */ > >> @SuppressWarnings("incomplete-switch") > >> - synchronized protected boolean write_user_loop(final NextFilter > next, > >> final WriteRequest request) > >> - throws SSLException { > >> + synchronized protected boolean write_user_loop(NextFilter next, > >> WriteRequest request) throws SSLException { > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} write_user_loop() - source {}", > toString(), > >> request); > >> } > >> > >> - final IoBuffer source = > IoBuffer.class.cast(request.getMessage()); > >> - final IoBuffer dest = > allocate_encode_buffer(source.remaining()); > >> + IoBuffer source = IoBuffer.class.cast(request.getMessage()); > >> + IoBuffer dest = allocate_encode_buffer(source.remaining()); > >> > >> - final SSLEngineResult result = this.mEngine.wrap(source.buf(), > >> dest.buf()); > >> + SSLEngineResult result = mEngine.wrap(source.buf(), > dest.buf()); > >> > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} write_user_loop() - bytes-consumed {}, > >> bytes-produced {}, status {}, handshake {}", > >> @@ -334,32 +379,42 @@ public class SSLHandlerG0 extends SSLHandler { > >> if (result.bytesConsumed() == 0) { > >> // an handshaking message must have been produced > >> EncryptedWriteRequest encrypted = new > >> EncryptedWriteRequest(dest, null); > >> + > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} write_user_loop() - result {}", > >> toString(), encrypted); > >> } > >> - next.filterWrite(this.mSession, encrypted); > >> + > >> + next.filterWrite(mSession, encrypted); > >> // do not return because we want to enter the > handshake > >> switch > >> } else { > >> // then we probably consumed some data > >> dest.flip(); > >> + > >> if (source.hasRemaining()) { > >> EncryptedWriteRequest encrypted = new > >> EncryptedWriteRequest(dest, null); > >> - this.mAckQueue.add(encrypted); > >> + mAckQueue.add(encrypted); > >> + > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} write_user_loop() - result > {}", > >> toString(), encrypted); > >> } > >> - next.filterWrite(this.mSession, encrypted); > >> - if (this.mAckQueue.size() < MAX_UNACK_MESSAGES) { > >> + > >> + next.filterWrite(mSession, encrypted); > >> + > >> + if (mAckQueue.size() < MAX_UNACK_MESSAGES) { > >> return write_user_loop(next, request); // > write > >> additional chunks > >> } > >> + > >> return false; > >> } else { > >> EncryptedWriteRequest encrypted = new > >> EncryptedWriteRequest(dest, request); > >> - this.mAckQueue.add(encrypted); > >> + mAckQueue.add(encrypted); > >> + > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} write_user_loop() - result > {}", > >> toString(), encrypted); > >> } > >> - next.filterWrite(this.mSession, encrypted); > >> + > >> + next.filterWrite(mSession, encrypted); > >> + > >> return true; > >> } > >> // we return because there is not reason to enter the > >> handshake switch > >> @@ -371,19 +426,26 @@ public class SSLHandlerG0 extends SSLHandler { > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} write_user_loop() - handshake > needs > >> task, scheduling", toString()); > >> } > >> - this.schedule_task(next); > >> + > >> + //schedule_task(next); > >> + execute_task(next); > >> break; > >> + > >> case NEED_WRAP: > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} write_user_loop() - handshake > needs > >> wrap, looping", toString()); > >> } > >> - return this.write_user_loop(next, request); > >> + > >> + return write_user_loop(next, request); > >> + > >> case FINISHED: > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} write_user_loop() - handshake > >> finished, flushing queue", toString()); > >> } > >> - this.finish_handshake(next); > >> - return this.write_user_loop(next, request); > >> + > >> + finish_handshake(next); > >> + > >> + return write_user_loop(next, request); > >> } > >> > >> return false; > >> @@ -403,8 +465,9 @@ public class SSLHandlerG0 extends SSLHandler { > >> LOGGER.debug("{} write_handshake() - internal", > toString()); > >> } > >> > >> - final IoBuffer source = ZERO; > >> - final IoBuffer dest = > allocate_encode_buffer(source.remaining()); > >> + IoBuffer source = ZERO; > >> + IoBuffer dest = allocate_encode_buffer(source.remaining()); > >> + > >> return write_handshake_loop(next, source, dest); > >> } > >> > >> @@ -424,11 +487,11 @@ public class SSLHandlerG0 extends SSLHandler { > >> */ > >> @SuppressWarnings("incomplete-switch") > >> protected boolean write_handshake_loop(NextFilter next, IoBuffer > >> source, IoBuffer dest) throws SSLException { > >> - if (this.mOutboundClosing && this.mEngine.isOutboundDone()) { > >> + if (mOutboundClosing && mEngine.isOutboundDone()) { > >> return false; > >> } > >> > >> - final SSLEngineResult result = this.mEngine.wrap(source.buf(), > >> dest.buf()); > >> + SSLEngineResult result = mEngine.wrap(source.buf(), > dest.buf()); > >> > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} write_handshake_loop() - bytes-consumed > {}, > >> bytes-produced {}, status {}, handshake {}", > >> @@ -455,23 +518,26 @@ public class SSLHandlerG0 extends SSLHandler { > >> LOGGER.debug("{} > write_handshake_loop() - > >> handshake needs wrap, fast looping", > >> toString()); > >> } > >> + > >> return write_handshake_loop(next, source, > >> dest); > >> } > >> break; > >> } > >> } > >> > >> - final boolean success = dest.position() != 0; > >> + boolean success = dest.position() != 0; > >> > >> if (success == false) { > >> dest.free(); > >> } else { > >> dest.flip(); > >> + > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} write_handshake_loop() - result {}", > >> toString(), dest); > >> } > >> - final EncryptedWriteRequest encrypted = new > >> EncryptedWriteRequest(dest, null); > >> - next.filterWrite(this.mSession, encrypted); > >> + > >> + EncryptedWriteRequest encrypted = new > >> EncryptedWriteRequest(dest, null); > >> + next.filterWrite(mSession, encrypted); > >> } > >> > >> switch (result.getHandshakeStatus()) { > >> @@ -479,25 +545,33 @@ public class SSLHandlerG0 extends SSLHandler { > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} write_handshake_loop() - > handshake > >> needs unwrap, invoking receive", toString()); > >> } > >> - this.receive(next, ZERO); > >> + > >> + receive(next, ZERO); > >> break; > >> + > >> case NEED_WRAP: > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} write_handshake_loop() - > handshake > >> needs wrap, looping", toString()); > >> } > >> - this.write_handshake(next); > >> + > >> + write_handshake(next); > >> break; > >> + > >> case NEED_TASK: > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} write_handshake_loop() - > handshake > >> needs task, scheduling", toString()); > >> } > >> - this.schedule_task(next); > >> + > >> + //schedule_task(next); > >> + execute_task(next); > >> break; > >> + > >> case FINISHED: > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} write_handshake_loop() - > handshake > >> finished, flushing queue", toString()); > >> } > >> - this.finish_handshake(next); > >> + > >> + finish_handshake(next); > >> break; > >> } > >> > >> @@ -510,17 +584,18 @@ public class SSLHandlerG0 extends SSLHandler { > >> * @param next > >> * @throws SSLException > >> */ > >> - synchronized protected void finish_handshake(final NextFilter next) > >> throws SSLException { > >> - if (this.mHandshakeComplete == false) { > >> - this.mHandshakeComplete = true; > >> - this.mSession.setAttribute(SSLFilter.SSL_SECURED, > >> this.mEngine.getSession()); > >> - next.event(this.mSession, SSLEvent.SECURED); > >> + synchronized protected void finish_handshake(NextFilter next) > throws > >> SSLException { > >> + if (mHandshakeComplete == false) { > >> + mHandshakeComplete = true; > >> + mSession.setAttribute(SslFilter.SSL_SECURED, > >> mEngine.getSession()); > >> + next.event(mSession, SslEvent.SECURED); > >> } > >> + > >> /** > >> * There exists a bug in the JDK which emits FINISHED twice > >> instead of once. > >> */ > >> - this.receive(next, ZERO); > >> - this.flush(next); > >> + receive(next, ZERO); > >> + flush(next); > >> } > >> > >> /** > >> @@ -530,33 +605,38 @@ public class SSLHandlerG0 extends SSLHandler { > >> * > >> * @throws SSLException > >> */ > >> - synchronized public void flush(final NextFilter next) throws > >> SSLException { > >> - if (this.mOutboundClosing && this.mOutboundLinger == false) { > >> + synchronized public void flush(NextFilter next) throws > SSLException { > >> + if (mOutboundClosing && mOutboundLinger == false) { > >> return; > >> } > >> > >> - if (this.mEncodeQueue.size() == 0) { > >> + if (mEncodeQueue.size() == 0) { > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} flush() - no saved messages", > >> toString()); > >> } > >> + > >> return; > >> } > >> > >> WriteRequest current = null; > >> - while ((this.mAckQueue.size() < MAX_UNACK_MESSAGES) && > (current = > >> this.mEncodeQueue.poll()) != null) { > >> + > >> + while ((mAckQueue.size() < MAX_UNACK_MESSAGES) && (current = > >> mEncodeQueue.poll()) != null) { > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} flush() - {}", toString(), current); > >> } > >> - if (this.write_user_loop(next, current) == false) { > >> - this.mEncodeQueue.addFirst(current); > >> + > >> + if (write_user_loop(next, current) == false) { > >> + mEncodeQueue.addFirst(current); > >> + > >> break; > >> } > >> } > >> > >> - if (this.mOutboundClosing && this.mEncodeQueue.size() == 0) { > >> - this.mEngine.closeOutbound(); > >> + if (mOutboundClosing && mEncodeQueue.size() == 0) { > >> + mEngine.closeOutbound(); > >> + > >> if (ENABLE_SOFT_CLOSURE) { > >> - this.write_handshake(next); > >> + write_handshake(next); > >> } > >> } > >> } > >> @@ -564,77 +644,105 @@ public class SSLHandlerG0 extends SSLHandler { > >> /** > >> * {@inheritDoc} > >> */ > >> - synchronized public void close(final NextFilter next, final boolean > >> linger) throws SSLException { > >> - if (this.mOutboundClosing) > >> + @Override > >> + synchronized public void close(NextFilter next, boolean linger) > >> throws SSLException { > >> + if (mOutboundClosing) { > >> return; > >> + } > >> > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} close() - closing session", toString()); > >> } > >> > >> - if (this.mHandshakeComplete) { > >> - next.event(this.mSession, SSLEvent.UNSECURED); > >> + if (mHandshakeComplete) { > >> + next.event(mSession, SslEvent.UNSECURED); > >> } > >> > >> - this.mOutboundLinger = linger; > >> - this.mOutboundClosing = true; > >> + mOutboundLinger = linger; > >> + mOutboundClosing = true; > >> > >> if (linger == false) { > >> - if (this.mEncodeQueue.size() != 0) { > >> - next.exceptionCaught(this.mSession, > >> - new WriteRejectedException(new > >> ArrayList<>(this.mEncodeQueue), "closing")); > >> - this.mEncodeQueue.clear(); > >> + if (mEncodeQueue.size() != 0) { > >> + next.exceptionCaught(mSession, new > >> WriteRejectedException(new ArrayList<>(mEncodeQueue), "closing")); > >> + mEncodeQueue.clear(); > >> } > >> - this.mEngine.closeOutbound(); > >> + > >> + mEngine.closeOutbound(); > >> + > >> if (ENABLE_SOFT_CLOSURE) { > >> - this.write_handshake(next); > >> + write_handshake(next); > >> } > >> } else { > >> - this.flush(next); > >> + flush(next); > >> } > >> } > >> > >> - synchronized protected void throw_pending_error() throws > SSLException > >> { > >> - final SSLException e = this.mPendingError; > >> - if (e != null) { > >> - this.mPendingError = null; > >> - throw e; > >> + /** > >> + * Process the pending error and loop to send the associated alert > if > >> we have some. > >> + * > >> + * @param next The next filter in the chain > >> + * @throws SSLException The rethrown pending error > >> + */ > >> + synchronized protected void throw_pending_error(NextFilter next) > >> throws SSLException { > >> + SSLException sslException = mPendingError; > >> + > >> + if (sslException != null) { > >> + // Loop to send back the alert messages > >> + receive_loop(next, null); > >> + > >> + mPendingError = null; > >> + > >> + // And finally rethrow the exception > >> + throw sslException; > >> } > >> } > >> > >> - synchronized protected void store_pending_error(SSLException e) { > >> - SSLException x = this.mPendingError; > >> - if (x == null) { > >> - this.mPendingError = e; > >> + /** > >> + * Store any error we've got during the handshake or message > handling > >> + * > >> + * @param sslException The exfeption to store > >> + */ > >> + synchronized protected void store_pending_error(SSLException > >> sslException) { > >> + if (mPendingError == null) { > >> + mPendingError = sslException; > >> } > >> } > >> > >> - protected void schedule_task(final NextFilter next) { > >> - if (ENABLE_ASYNC_TASKS) { > >> - if (this.mExecutor == null) { > >> - this.execute_task(next); > >> - } else { > >> - this.mExecutor.execute(new Runnable() { > >> - @Override > >> - public void run() { > >> - SSLHandlerG0.this.execute_task(next); > >> - } > >> - }); > >> - } > >> + /** > >> + * Schedule a SSLEngine task for execution, either using an > Executor, > >> or immediately. > >> + * > >> + * @param next The next filter to call > >> + */ > >> + protected void schedule_task(NextFilter next) { > >> + if (ENABLE_ASYNC_TASKS && (mExecutor != null)) { > >> + mExecutor.execute(new Runnable() { > >> + @Override > >> + public void run() { > >> + SSLHandlerG0.this.execute_task(next); > >> + } > >> + }); > >> } else { > >> - this.execute_task(next); > >> + execute_task(next); > >> } > >> } > >> > >> - synchronized protected void execute_task(final NextFilter next) { > >> - Runnable t = null; > >> - while ((t = mEngine.getDelegatedTask()) != null) { > >> + /** > >> + * Execute a SSLEngine task. We may have more than one. > >> + * > >> + * If we get any exception during the processing, an error is > stored > >> and thrown. > >> + * > >> + * @param next The next filer in the chain > >> + */ > >> + synchronized protected void execute_task(NextFilter next) { > >> + Runnable task = null; > >> + > >> + while ((task = mEngine.getDelegatedTask()) != null) { > >> try { > >> if (LOGGER.isDebugEnabled()) { > >> - LOGGER.debug("{} task() - executing {}", > toString(), > >> t); > >> + LOGGER.debug("{} task() - executing {}", > toString(), > >> task); > >> } > >> > >> - t.run(); > >> + task.run(); > >> > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("{} task() - writing handshake > >> messages", toString()); > >> @@ -642,7 +750,14 @@ public class SSLHandlerG0 extends SSLHandler { > >> > >> write_handshake(next); > >> } catch (SSLException e) { > >> - this.store_pending_error(e); > >> + store_pending_error(e); > >> + > >> + try { > >> + throw_pending_error(next); > >> + } catch ( SSLException ssle) { > >> + // ... > >> + } > >> + > >> if (LOGGER.isErrorEnabled()) { > >> LOGGER.error("{} task() - storing error {}", > >> toString(), e); > >> } > >> diff --git > >> > a/mina-core/src/main/java/org/apache/mina/filter/ssl/SSLContextFactory.java > >> > b/mina-core/src/main/java/org/apache/mina/filter/ssl/SslContextFactory.java > >> similarity index 99% > >> rename from > >> > mina-core/src/main/java/org/apache/mina/filter/ssl/SSLContextFactory.java > >> rename to > >> > mina-core/src/main/java/org/apache/mina/filter/ssl/SslContextFactory.java > >> index 9763954..d19b9b3 100644 > >> --- > >> > a/mina-core/src/main/java/org/apache/mina/filter/ssl/SSLContextFactory.java > >> +++ > >> > b/mina-core/src/main/java/org/apache/mina/filter/ssl/SslContextFactory.java > >> @@ -49,7 +49,7 @@ import javax.net.ssl.TrustManagerFactory; > >> * > >> * @author <a href="http://mina.apache.org">Apache MINA Project</a> > >> */ > >> -public class SSLContextFactory { > >> +public class SslContextFactory { > >> > >> private String provider = null; > >> > >> diff --git > >> a/mina-core/src/main/java/org/apache/mina/filter/ssl/SSLEvent.java > >> b/mina-core/src/main/java/org/apache/mina/filter/ssl/SslEvent.java > >> similarity index 95% > >> rename from > >> mina-core/src/main/java/org/apache/mina/filter/ssl/SSLEvent.java > >> rename to > mina-core/src/main/java/org/apache/mina/filter/ssl/SslEvent.java > >> index 21ad1d3..bd75845 100644 > >> --- a/mina-core/src/main/java/org/apache/mina/filter/ssl/SSLEvent.java > >> +++ b/mina-core/src/main/java/org/apache/mina/filter/ssl/SslEvent.java > >> @@ -27,6 +27,6 @@ import org.apache.mina.filter.FilterEvent; > >> * > >> * @author <a href="http://mina.apache.org">Apache MINA Project</a> > >> */ > >> -public enum SSLEvent implements FilterEvent { > >> +public enum SslEvent implements FilterEvent { > >> SECURED, UNSECURED > >> } > >> diff --git > >> a/mina-core/src/main/java/org/apache/mina/filter/ssl/SSLFilter.java > >> b/mina-core/src/main/java/org/apache/mina/filter/ssl/SslFilter.java > >> similarity index 93% > >> rename from > >> mina-core/src/main/java/org/apache/mina/filter/ssl/SSLFilter.java > >> rename to > mina-core/src/main/java/org/apache/mina/filter/ssl/SslFilter.java > >> index 61f0917..2503d26 100644 > >> --- a/mina-core/src/main/java/org/apache/mina/filter/ssl/SSLFilter.java > >> +++ b/mina-core/src/main/java/org/apache/mina/filter/ssl/SslFilter.java > >> @@ -50,21 +50,21 @@ import org.slf4j.LoggerFactory; > >> * @author Jonathan Valliere > >> * @author <a href="http://mina.apache.org">Apache MINA Project</a> > >> */ > >> -public class SSLFilter extends IoFilterAdapter { > >> +public class SslFilter extends IoFilterAdapter { > >> /** > >> * SSLSession object when the session is secured, otherwise null. > >> */ > >> - static public final AttributeKey SSL_SECURED = new > >> AttributeKey(SSLFilter.class, "status"); > >> + static public final AttributeKey SSL_SECURED = new > >> AttributeKey(SslFilter.class, "status"); > >> > >> /** > >> * Returns the SSL2Handler object > >> */ > >> - static protected final AttributeKey SSL_HANDLER = new > >> AttributeKey(SSLFilter.class, "handler"); > >> + static protected final AttributeKey SSL_HANDLER = new > >> AttributeKey(SslFilter.class, "handler"); > >> > >> /** > >> * The logger > >> */ > >> - static protected final Logger LOGGER = > >> LoggerFactory.getLogger(SSLFilter.class); > >> + static protected final Logger LOGGER = > >> LoggerFactory.getLogger(SslFilter.class); > >> > >> /** > >> * Task executor for processing handshakes > >> @@ -103,7 +103,7 @@ public class SSLFilter extends IoFilterAdapter { > >> * > >> * @param sslContext The SSLContext to use > >> */ > >> - public SSLFilter(SSLContext sslContext) { > >> + public SslFilter(SSLContext sslContext) { > >> Objects.requireNonNull(sslContext, "ssl must not be null"); > >> > >> this.sslContext = sslContext; > >> @@ -191,7 +191,7 @@ public class SSLFilter extends IoFilterAdapter { > >> @Override > >> public void onPreAdd(IoFilterChain parent, String name, NextFilter > >> next) throws Exception { > >> // Check that we don't have a SSL filter already present in > the > >> chain > >> - if (parent.contains(SSLFilter.class)) { > >> + if (parent.contains(SslFilter.class)) { > >> throw new IllegalStateException("Only one SSL filter is > >> permitted in a chain"); > >> } > >> > >> @@ -232,7 +232,7 @@ public class SSLFilter extends IoFilterAdapter { > >> * @throws SSLException Any exception thrown by the SslHandler > closing > >> */ > >> synchronized protected void onConnected(NextFilter next, IoSession > >> session) throws SSLException { > >> - SSLHandler sslHandler = > >> SSLHandler.class.cast(session.getAttribute(SSL_HANDLER)); > >> + SslHandler sslHandler = > >> SslHandler.class.cast(session.getAttribute(SSL_HANDLER)); > >> > >> if (sslHandler == null) { > >> InetSocketAddress s = > >> InetSocketAddress.class.cast(session.getRemoteAddress()); > >> @@ -254,7 +254,7 @@ public class SSLFilter extends IoFilterAdapter { > >> */ > >> synchronized protected void onClose(NextFilter next, IoSession > >> session, boolean linger) throws SSLException { > >> session.removeAttribute(SSL_SECURED); > >> - SSLHandler sslHandler = > >> SSLHandler.class.cast(session.removeAttribute(SSL_HANDLER)); > >> + SslHandler sslHandler = > >> SslHandler.class.cast(session.removeAttribute(SSL_HANDLER)); > >> > >> if (sslHandler != null) { > >> sslHandler.close(next, linger); > >> @@ -318,11 +318,19 @@ public class SSLFilter extends IoFilterAdapter { > >> */ > >> @Override > >> public void messageReceived(NextFilter next, IoSession session, > >> Object message) throws Exception { > >> + //if (session.isServer()) { > >> + //System.out.println( ">>> Server messageReceived" ); > >> + //} else { > >> + //System.out.println( ">>> Client messageReceived" ); > >> + //} > >> + > >> + //System.out.println( message ); > >> + > >> if (LOGGER.isDebugEnabled()) { > >> LOGGER.debug("session {} received {}", session, message); > >> } > >> > >> - SSLHandler sslHandler = > >> SSLHandler.class.cast(session.getAttribute(SSL_HANDLER)); > >> + SslHandler sslHandler = > >> SslHandler.class.cast(session.getAttribute(SSL_HANDLER)); > >> sslHandler.receive(next, IoBuffer.class.cast(message)); > >> } > >> > >> @@ -337,7 +345,7 @@ public class SSLFilter extends IoFilterAdapter { > >> > >> if (request instanceof EncryptedWriteRequest) { > >> EncryptedWriteRequest encryptedWriteRequest = > >> EncryptedWriteRequest.class.cast(request); > >> - SSLHandler sslHandler = > >> SSLHandler.class.cast(session.getAttribute(SSL_HANDLER)); > >> + SslHandler sslHandler = > >> SslHandler.class.cast(session.getAttribute(SSL_HANDLER)); > >> sslHandler.ack(next, request); > >> > >> if (encryptedWriteRequest.getOriginalRequest() != > >> encryptedWriteRequest) { > >> @@ -360,7 +368,7 @@ public class SSLFilter extends IoFilterAdapter { > >> if (request instanceof EncryptedWriteRequest || request > >> instanceof DisableEncryptWriteRequest) { > >> super.filterWrite(next, session, request); > >> } else { > >> - SSLHandler sslHandler = > >> SSLHandler.class.cast(session.getAttribute(SSL_HANDLER)); > >> + SslHandler sslHandler = > >> SslHandler.class.cast(session.getAttribute(SSL_HANDLER)); > >> sslHandler.write(next, request); > >> } > >> } > >> diff --git > >> a/mina-core/src/main/java/org/apache/mina/filter/ssl/SSLHandler.java > >> b/mina-core/src/main/java/org/apache/mina/filter/ssl/SslHandler.java > >> similarity index 98% > >> rename from > >> mina-core/src/main/java/org/apache/mina/filter/ssl/SSLHandler.java > >> rename to > >> mina-core/src/main/java/org/apache/mina/filter/ssl/SslHandler.java > >> index d1a0ffe..fd2c528 100644 > >> --- a/mina-core/src/main/java/org/apache/mina/filter/ssl/SSLHandler.java > >> +++ b/mina-core/src/main/java/org/apache/mina/filter/ssl/SslHandler.java > >> @@ -41,7 +41,7 @@ import org.slf4j.LoggerFactory; > >> * @author Jonathan Valliere > >> * @author <a href="http://mina.apache.org">Apache MINA Project</a> > >> */ > >> -public abstract class SSLHandler { > >> +public abstract class SslHandler { > >> > >> /** > >> * Minimum size of encoder buffer in packets > >> @@ -61,7 +61,7 @@ public abstract class SSLHandler { > >> /** > >> * Static logger > >> */ > >> - static protected final Logger LOGGER = > >> LoggerFactory.getLogger(SSLHandler.class); > >> + static protected final Logger LOGGER = > >> LoggerFactory.getLogger(SslHandler.class); > >> > >> /** > >> * Write Requests which are enqueued prior to the completion of > the > >> handshaking > >> @@ -100,7 +100,7 @@ public abstract class SSLHandler { > >> * @param e executor > >> * @param s session > >> */ > >> - public SSLHandler(SSLEngine p, Executor e, IoSession s) { > >> + public SslHandler(SSLEngine p, Executor e, IoSession s) { > >> this.mEngine = p; > >> this.mExecutor = e; > >> this.mSession = s; > >> diff --git > >> > a/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketSession.java > >> > b/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketSession.java > >> index e7ab682..69e1cc1 100644 > >> --- > >> > a/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketSession.java > >> +++ > >> > b/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketSession.java > >> @@ -32,7 +32,7 @@ import org.apache.mina.core.service.IoProcessor; > >> import org.apache.mina.core.service.IoService; > >> import org.apache.mina.core.service.TransportMetadata; > >> import org.apache.mina.core.session.IoSession; > >> -import org.apache.mina.filter.ssl.SSLFilter; > >> +import org.apache.mina.filter.ssl.SslFilter; > >> import org.apache.mina.transport.socket.AbstractSocketSessionConfig; > >> import org.apache.mina.transport.socket.SocketSessionConfig; > >> > >> @@ -340,6 +340,6 @@ class NioSocketSession extends NioSession { > >> */ > >> @Override > >> public final boolean isSecured() { > >> - return (this.getAttribute(SSLFilter.SSL_SECURED) != null); > >> + return (this.getAttribute(SslFilter.SSL_SECURED) != null); > >> } > >> } > >> diff --git > >> > a/mina-core/src/test/java/org/apache/mina/core/service/SSLTestHandshakeExceptionDIRMINA1077Test.java > >> > b/mina-core/src/test/java/org/apache/mina/core/service/SSLTestHandshakeExceptionDIRMINA1077Test.java > >> index cc03fef..157e5a2 100644 > >> --- > >> > a/mina-core/src/test/java/org/apache/mina/core/service/SSLTestHandshakeExceptionDIRMINA1077Test.java > >> +++ > >> > b/mina-core/src/test/java/org/apache/mina/core/service/SSLTestHandshakeExceptionDIRMINA1077Test.java > >> @@ -40,7 +40,7 @@ import org.apache.mina.core.future.ConnectFuture; > >> import org.apache.mina.core.session.IoSession; > >> import org.apache.mina.filter.codec.ProtocolCodecFilter; > >> import org.apache.mina.filter.codec.textline.TextLineCodecFactory; > >> -import org.apache.mina.filter.ssl.SSLFilter; > >> +import org.apache.mina.filter.ssl.SslFilter; > >> import org.apache.mina.transport.socket.nio.NioSocketAcceptor; > >> import org.apache.mina.transport.socket.nio.NioSocketConnector; > >> import org.apache.mina.util.AvailablePortFinder; > >> @@ -90,7 +90,7 @@ public class SSLTestHandshakeExceptionDIRMINA1077Test > { > >> DefaultIoFilterChainBuilder filters = > acceptor.getFilterChain(); > >> > >> // Inject the SSL filter > >> - SSLFilter sslFilter = new SSLFilter(createSSLContext(true)); > >> + SslFilter sslFilter = new SslFilter(createSSLContext(true)); > >> filters.addLast("sslFilter", sslFilter); > >> sslFilter.setNeedClientAuth(true); > >> > >> @@ -111,7 +111,7 @@ public class > SSLTestHandshakeExceptionDIRMINA1077Test { > >> DefaultIoFilterChainBuilder filters = > >> nioSocketConnector.getFilterChain(); > >> > >> // Inject the SSL filter > >> - SSLFilter sslFilter = new SSLFilter(createSSLContext(false)); > >> + SslFilter sslFilter = new SslFilter(createSSLContext(false)); > >> filters.addLast("sslFilter", sslFilter); > >> > >> address = InetAddress.getByName("localhost"); > >> diff --git > >> a/mina-core/src/test/java/org/apache/mina/filter/ssl/SSLFilterMain.java > >> b/mina-core/src/test/java/org/apache/mina/filter/ssl/SslFilterMain.java > >> similarity index 95% > >> rename from > >> mina-core/src/test/java/org/apache/mina/filter/ssl/SSLFilterMain.java > >> rename to > >> mina-core/src/test/java/org/apache/mina/filter/ssl/SslFilterMain.java > >> index aeb75c6..a2dd900 100644 > >> --- > a/mina-core/src/test/java/org/apache/mina/filter/ssl/SSLFilterMain.java > >> +++ > b/mina-core/src/test/java/org/apache/mina/filter/ssl/SslFilterMain.java > >> @@ -26,7 +26,7 @@ import > >> org.apache.mina.transport.socket.nio.NioSocketConnector; > >> import org.slf4j.Logger; > >> import org.slf4j.LoggerFactory; > >> > >> -public class SSLFilterMain { > >> +public class SslFilterMain { > >> > >> public static void main(String[] args) throws > >> NoSuchAlgorithmException, KeyManagementException, KeyStoreException, > >> UnrecoverableKeyException, CertificateException, > IOException { > >> @@ -40,8 +40,8 @@ public class SSLFilterMain { > >> > >> final char[] password = "password".toCharArray(); > >> > >> - > ks.load(SSLFilterMain.class.getResourceAsStream("keystore.jks"), > >> password); > >> - > >> ts.load(SSLFilterMain.class.getResourceAsStream("truststore.jks"), > >> password); > >> + > ks.load(SslFilterMain.class.getResourceAsStream("keystore.jks"), > >> password); > >> + > >> ts.load(SslFilterMain.class.getResourceAsStream("truststore.jks"), > >> password); > >> > >> kmf.init(ks, password); > >> tmf.init(ts); > >> @@ -49,7 +49,7 @@ public class SSLFilterMain { > >> final SSLContext context = SSLContext.getInstance("TLSv1.3"); > >> context.init(kmf.getKeyManagers(), tmf.getTrustManagers(), new > >> SecureRandom()); > >> > >> - final SSLFilter filter = new SSLFilter(context); > >> + final SslFilter filter = new SslFilter(context); > >> filter.setEnabledCipherSuites(new String[] { > >> "TLS_AES_128_GCM_SHA256", "TLS_AES_256_GCM_SHA384" }); > >> filter.setEnabledProtocols(new String[] { "TLSv1.3" }); > >> > >> diff --git > >> a/mina-example/src/main/java/org/apache/mina/example/chat/Main.java > >> b/mina-example/src/main/java/org/apache/mina/example/chat/Main.java > >> index b2637f3..a936974 100644 > >> --- a/mina-example/src/main/java/org/apache/mina/example/chat/Main.java > >> +++ b/mina-example/src/main/java/org/apache/mina/example/chat/Main.java > >> @@ -28,7 +28,7 @@ import > >> org.apache.mina.filter.codec.textline.TextLineCodecFactory; > >> import org.apache.mina.filter.compression.CompressionFilter; > >> import org.apache.mina.filter.logging.LoggingFilter; > >> import org.apache.mina.filter.logging.MdcInjectionFilter; > >> -import org.apache.mina.filter.ssl.SSLFilter; > >> +import org.apache.mina.filter.ssl.SslFilter; > >> import org.apache.mina.transport.socket.nio.NioSocketAcceptor; > >> > >> /** > >> @@ -72,7 +72,7 @@ public class Main { > >> > >> private static void addSSLSupport(DefaultIoFilterChainBuilder > chain) > >> throws Exception { > >> - SSLFilter sslFilter = new SSLFilter(BogusSSLContextFactory > >> + SslFilter sslFilter = new SslFilter(BogusSSLContextFactory > >> .getInstance(true)); > >> chain.addLast("sslFilter", sslFilter); > >> System.out.println("SSL ON"); > >> diff --git > >> > a/mina-example/src/main/java/org/apache/mina/example/chat/client/ChatClientSupport.java > >> > b/mina-example/src/main/java/org/apache/mina/example/chat/client/ChatClientSupport.java > >> index f5c2543..cae59ad 100644 > >> --- > >> > a/mina-example/src/main/java/org/apache/mina/example/chat/client/ChatClientSupport.java > >> +++ > >> > b/mina-example/src/main/java/org/apache/mina/example/chat/client/ChatClientSupport.java > >> @@ -33,7 +33,7 @@ import > >> org.apache.mina.filter.codec.textline.TextLineCodecFactory; > >> import org.apache.mina.filter.compression.CompressionFilter; > >> import org.apache.mina.filter.logging.LoggingFilter; > >> import org.apache.mina.filter.logging.MdcInjectionFilter; > >> -import org.apache.mina.filter.ssl.SSLFilter; > >> +import org.apache.mina.filter.ssl.SslFilter; > >> import org.apache.mina.transport.socket.nio.NioSocketConnector; > >> > >> /** > >> @@ -79,7 +79,7 @@ public class ChatClientSupport { > >> if (useSsl) { > >> SSLContext sslContext = BogusSSLContextFactory > >> .getInstance(false); > >> - SSLFilter sslFilter = new SSLFilter(sslContext); > >> + SslFilter sslFilter = new SslFilter(sslContext); > >> connector.getFilterChain().addFirst("sslFilter", > >> sslFilter); > >> } > >> > >> diff --git > >> > a/mina-example/src/main/java/org/apache/mina/example/echoserver/Main.java > >> > b/mina-example/src/main/java/org/apache/mina/example/echoserver/Main.java > >> index 7e1c7aa..078f79e 100644 > >> --- > >> > a/mina-example/src/main/java/org/apache/mina/example/echoserver/Main.java > >> +++ > >> > b/mina-example/src/main/java/org/apache/mina/example/echoserver/Main.java > >> @@ -24,7 +24,7 @@ import java.net.InetSocketAddress; > >> import org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder; > >> import org.apache.mina.example.echoserver.ssl.BogusSSLContextFactory; > >> import org.apache.mina.filter.compression.CompressionFilter; > >> -import org.apache.mina.filter.ssl.SSLFilter; > >> +import org.apache.mina.filter.ssl.SslFilter; > >> import org.apache.mina.transport.socket.SocketAcceptor; > >> import org.apache.mina.transport.socket.nio.NioSocketAcceptor; > >> > >> @@ -68,7 +68,7 @@ public class Main { > >> > >> private static void addSSLSupport(DefaultIoFilterChainBuilder > chain) > >> throws Exception { > >> - SSLFilter sslFilter = new SSLFilter(BogusSSLContextFactory > >> + SslFilter sslFilter = new SslFilter(BogusSSLContextFactory > >> .getInstance(true)); > >> chain.addLast("sslFilter", sslFilter); > >> System.out.println("SSL ON"); > >> diff --git > >> > a/mina-example/src/main/java/org/apache/mina/example/tcp/perf/TcpSslClient.java > >> > b/mina-example/src/main/java/org/apache/mina/example/tcp/perf/TcpSslClient.java > >> index dd469bf..dca3501 100644 > >> --- > >> > a/mina-example/src/main/java/org/apache/mina/example/tcp/perf/TcpSslClient.java > >> +++ > >> > b/mina-example/src/main/java/org/apache/mina/example/tcp/perf/TcpSslClient.java > >> @@ -32,7 +32,7 @@ import org.apache.mina.core.service.IoConnector; > >> import org.apache.mina.core.service.IoHandlerAdapter; > >> import org.apache.mina.core.session.IdleStatus; > >> import org.apache.mina.core.session.IoSession; > >> -import org.apache.mina.filter.ssl.SSLFilter; > >> +import org.apache.mina.filter.ssl.SslFilter; > >> import org.apache.mina.transport.socket.nio.NioSocketConnector; > >> > >> /** > >> @@ -70,7 +70,7 @@ public class TcpSslClient extends IoHandlerAdapter { > >> // Inject teh SSL filter > >> SSLContext sslContext = BogusSSLContextFactory > >> .getInstance(false); > >> - SSLFilter sslFilter = new SSLFilter(sslContext); > >> + SslFilter sslFilter = new SslFilter(sslContext); > >> connector.getFilterChain().addFirst("sslFilter", sslFilter); > >> > >> connector.setHandler(this); > >> diff --git > >> > a/mina-example/src/main/java/org/apache/mina/example/tcp/perf/TcpSslServer.java > >> > b/mina-example/src/main/java/org/apache/mina/example/tcp/perf/TcpSslServer.java > >> index 9bb972c..96b1f50 100644 > >> --- > >> > a/mina-example/src/main/java/org/apache/mina/example/tcp/perf/TcpSslServer.java > >> +++ > >> > b/mina-example/src/main/java/org/apache/mina/example/tcp/perf/TcpSslServer.java > >> @@ -29,7 +29,7 @@ import org.apache.mina.core.service.IoHandlerAdapter; > >> import org.apache.mina.core.session.IdleStatus; > >> import org.apache.mina.core.session.IoSession; > >> import org.apache.mina.example.echoserver.ssl.BogusSSLContextFactory; > >> -import org.apache.mina.filter.ssl.SSLFilter; > >> +import org.apache.mina.filter.ssl.SslFilter; > >> import org.apache.mina.transport.socket.nio.NioSocketAcceptor; > >> > >> /** > >> @@ -136,7 +136,7 @@ public class TcpSslServer extends IoHandlerAdapter { > >> > >> // Inject the SSL filter > >> DefaultIoFilterChainBuilder chain = acceptor.getFilterChain(); > >> - SSLFilter sslFilter = new SSLFilter(BogusSSLContextFactory > >> + SslFilter sslFilter = new SslFilter(BogusSSLContextFactory > >> .getInstance(true)); > >> chain.addLast("sslFilter", sslFilter); > >> > >> diff --git > >> > a/mina-example/src/main/resources/org/apache/mina/example/chat/serverContext.xml > >> > b/mina-example/src/main/resources/org/apache/mina/example/chat/serverContext.xml > >> index c5b7810..6e78e15 100644 > >> --- > >> > a/mina-example/src/main/resources/org/apache/mina/example/chat/serverContext.xml > >> +++ > >> > b/mina-example/src/main/resources/org/apache/mina/example/chat/serverContext.xml > >> @@ -49,7 +49,7 @@ > >> <bean id="bogusTrustManagerFactory" > >> class="org.apache.mina.filter.ssl.BogusTrustManagerFactory"/> > >> > >> <!-- SSLContext to be used --> > >> - <bean id="sslContextFactory" > >> class="org.apache.mina.filter.ssl.SSLContextFactory"> > >> + <bean id="sslContextFactory" > >> class="org.apache.mina.filter.ssl.SslContextFactory"> > >> <property name="protocol" value="TLS"/> > >> <property name="keyManagerFactoryAlgorithm" value="SunX509"/> > >> <property name="keyManagerFactoryKeyStore"><ref > >> local="keyStore"/></property> > >> @@ -75,7 +75,7 @@ > >> > >> <bean id="loggingFilter" > >> class="org.apache.mina.filter.logging.LoggingFilter" /> > >> > >> - <bean id="sslFilter" class="org.apache.mina.filter.ssl.SSLFilter"> > >> + <bean id="sslFilter" class="org.apache.mina.filter.ssl.SslFilter"> > >> <constructor-arg ref="sslContext"/> > >> </bean> > >> > >> diff --git > >> > a/mina-example/src/test/java/org/apache/mina/example/echoserver/AbstractTest.java > >> > b/mina-example/src/test/java/org/apache/mina/example/echoserver/AbstractTest.java > >> index 733017d..6f5e7df 100644 > >> --- > >> > a/mina-example/src/test/java/org/apache/mina/example/echoserver/AbstractTest.java > >> +++ > >> > b/mina-example/src/test/java/org/apache/mina/example/echoserver/AbstractTest.java > >> @@ -30,7 +30,7 @@ import org.apache.mina.core.service.IoAcceptor; > >> import org.apache.mina.core.session.IoSession; > >> import org.apache.mina.example.echoserver.ssl.BogusSSLContextFactory; > >> import org.apache.mina.filter.FilterEvent; > >> -import org.apache.mina.filter.ssl.SSLFilter; > >> +import org.apache.mina.filter.ssl.SslFilter; > >> import org.apache.mina.transport.socket.DatagramSessionConfig; > >> import org.apache.mina.transport.socket.nio.NioDatagramAcceptor; > >> import org.apache.mina.transport.socket.nio.NioSocketAcceptor; > >> @@ -122,7 +122,7 @@ public abstract class AbstractTest { > >> try { > >> session.getFilterChain().addFirst( > >> "SSL", > >> - new > SSLFilter(BogusSSLContextFactory > >> + new > SslFilter(BogusSSLContextFactory > >> .getInstance(true))); > >> } catch (GeneralSecurityException e) { > >> LOGGER.error("", e); > >> diff --git > >> > a/mina-example/src/test/java/org/apache/mina/example/echoserver/ConnectorTest.java > >> > b/mina-example/src/test/java/org/apache/mina/example/echoserver/ConnectorTest.java > >> index d78f923..18b6a6a 100644 > >> --- > >> > a/mina-example/src/test/java/org/apache/mina/example/echoserver/ConnectorTest.java > >> +++ > >> > b/mina-example/src/test/java/org/apache/mina/example/echoserver/ConnectorTest.java > >> @@ -33,7 +33,7 @@ import org.apache.mina.core.service.IoHandlerAdapter; > >> import org.apache.mina.core.session.IoSession; > >> import org.apache.mina.core.write.WriteException; > >> import org.apache.mina.example.echoserver.ssl.BogusSSLContextFactory; > >> -import org.apache.mina.filter.ssl.SSLFilter; > >> +import org.apache.mina.filter.ssl.SslFilter; > >> import org.apache.mina.transport.socket.nio.NioDatagramConnector; > >> import org.apache.mina.transport.socket.nio.NioSocketConnector; > >> import org.apache.mina.util.AvailablePortFinder; > >> @@ -58,7 +58,7 @@ public class ConnectorTest extends AbstractTest { > >> private final int DATA_SIZE = 16; > >> > >> private EchoConnectorHandler handler; > >> - private SSLFilter connectorSSLFilter; > >> + private SslFilter connectorSslFilter; > >> > >> public ConnectorTest() { > >> // Do nothing > >> @@ -68,7 +68,7 @@ public class ConnectorTest extends AbstractTest { > >> public void setUp() throws Exception { > >> super.setUp(); > >> handler = new EchoConnectorHandler(); > >> - connectorSSLFilter = new SSLFilter(BogusSSLContextFactory > >> + connectorSslFilter = new SslFilter(BogusSSLContextFactory > >> .getInstance(false)); > >> } > >> > >> @@ -86,7 +86,7 @@ public class ConnectorTest extends AbstractTest { > >> IoConnector connector = new NioSocketConnector(); > >> > >> // Add an SSL filter to connector > >> - connector.getFilterChain().addLast("SSL", connectorSSLFilter); > >> + connector.getFilterChain().addLast("SSL", connectorSslFilter); > >> testConnector(connector); > >> } > >> > >> @@ -159,7 +159,7 @@ public class ConnectorTest extends AbstractTest { > >> assertEquals((byte) '.', handler.readBuf.get()); > >> > >> // Now start TLS connection > >> - session.getFilterChain().addFirst("SSL", > connectorSSLFilter); > >> + session.getFilterChain().addFirst("SSL", > connectorSslFilter); > >> testConnector0(session); > >> } > >> > >> diff --git > >> > a/mina-example/src/test/java/org/apache/mina/example/echoserver/ssl/SSLFilterTest.java > >> > b/mina-example/src/test/java/org/apache/mina/example/echoserver/ssl/SslFilterTest.java > >> similarity index 97% > >> rename from > >> > mina-example/src/test/java/org/apache/mina/example/echoserver/ssl/SSLFilterTest.java > >> rename to > >> > mina-example/src/test/java/org/apache/mina/example/echoserver/ssl/SslFilterTest.java > >> index f95d0cc..1f5bd99 100644 > >> --- > >> > a/mina-example/src/test/java/org/apache/mina/example/echoserver/ssl/SSLFilterTest.java > >> +++ > >> > b/mina-example/src/test/java/org/apache/mina/example/echoserver/ssl/SslFilterTest.java > >> @@ -41,7 +41,7 @@ import org.apache.mina.core.service.IoHandlerAdapter; > >> import org.apache.mina.core.session.IoSession; > >> import org.apache.mina.filter.codec.ProtocolCodecFilter; > >> import org.apache.mina.filter.codec.textline.TextLineCodecFactory; > >> -import org.apache.mina.filter.ssl.SSLFilter; > >> +import org.apache.mina.filter.ssl.SslFilter; > >> import org.apache.mina.transport.socket.SocketAcceptor; > >> import org.apache.mina.transport.socket.nio.NioSocketAcceptor; > >> import org.junit.After; > >> @@ -53,7 +53,7 @@ import org.junit.Test; > >> * > >> * @author <a href="http://mina.apache.org">Apache MINA Project</a> > >> */ > >> -public class SSLFilterTest { > >> +public class SslFilterTest { > >> > >> private int port; > >> private SocketAcceptor acceptor; > >> @@ -84,9 +84,9 @@ public class SSLFilterTest { > >> // > >> http://java.sun.com/javase/javaseforbusiness/docs/TLSReadme.html > >> > >> > java.lang.System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", > >> "true"); > >> > >> - SSLFilter sslFilter = null; > >> + SslFilter sslFilter = null; > >> if (useSSL) { > >> - sslFilter = new > >> SSLFilter(BogusSSLContextFactory.getInstance(true)); > >> + sslFilter = new > >> SslFilter(BogusSSLContextFactory.getInstance(true)); > >> acceptor.getFilterChain().addLast("sslFilter", sslFilter); > >> } > >> acceptor.getFilterChain().addLast("codec", > >> > > > > -- > *Emmanuel Lécharny - CTO* 205 Promenade des Anglais – 06200 NICE > T. +33 (0)4 89 97 36 50 > P. +33 (0)6 08 33 32 61 > [email protected] https://www.busit.com/ >
