Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[HORNETQ-1103] Upgrade Netty to fix SSL race. Also maximal wait 30 se…

…conds for the handshake to complete
  • Loading branch information...
commit 405f6d403e8bfcc1e4756568236e20eb8113243c 1 parent 5bd6c4d
Norman Maurer authored
20 hornetq-core-client/src/main/java/org/hornetq/core/remoting/impl/netty/NettyConnector.java
View
@@ -33,6 +33,7 @@
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
+import javax.net.ssl.SSLException;
import org.hornetq.api.config.HornetQDefaultConfiguration;
import org.hornetq.api.core.HornetQException;
@@ -511,16 +512,25 @@ public Connection createConnection()
if (sslHandler != null)
{
ChannelFuture handshakeFuture = sslHandler.handshake();
- handshakeFuture.awaitUninterruptibly();
- if (handshakeFuture.isSuccess())
+ if (handshakeFuture.awaitUninterruptibly(30000))
{
- ch.getPipeline().get(HornetQChannelHandler.class).active = true;
+ if (handshakeFuture.isSuccess())
+ {
+ ch.getPipeline().get(HornetQChannelHandler.class).active = true;
+ }
+ else
+ {
+ ch.close().awaitUninterruptibly();
+ return null;
+ }
}
else
{
- ch.close().awaitUninterruptibly();
- return null;
+ handshakeFuture.setFailure(new SSLException("Handshake was not completed in 30 seconds"));
+ ch.close().awaitUninterruptibly();
+ return null;
}
+
}
else
{
2  pom.xml
View
@@ -30,7 +30,7 @@
</prerequisites>
<properties>
- <netty.version>3.4.5.Final</netty.version>
+ <netty.version>3.6.1.Final</netty.version>
<netty.version.string>${netty-version}-2da5b0e</netty.version.string>
<hornetq.version.versionName>black'n'yellow</hornetq.version.versionName>
<hornetq.version.majorVersion>2</hornetq.version.majorVersion>
11 tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java
View
@@ -219,6 +219,17 @@ public ChannelFuture bind(final SocketAddress arg0)
{
return null;
}
+
+ @Override
+ public Object getAttachment()
+ {
+ return null;
+ }
+
+ @Override
+ public void setAttachment(Object attachment) {
+ // nothing to-do
+ }
}
class MyListener implements ConnectionLifeCycleListener
Please sign in to comment.
Something went wrong with that request. Please try again.