https://issues.apache.org/jira/browse/AMQ-3300 - Add support for soWriteTimeout and soTimeout to ssl transport

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1097191 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2011-04-27 17:40:57 +00:00
parent 86f3da3f83
commit 12838c2811
3 changed files with 13 additions and 25 deletions

View File

@ -88,34 +88,15 @@ public class SslTransportFactory extends TcpTransportFactory {
}
/**
* Overriding to allow for proper configuration through reflection.
* Overriding to allow for proper configuration through reflection but delegate to get common
* configuration
*/
public Transport compositeConfigure(Transport transport, WireFormat format, Map options) {
SslTransport sslTransport = (SslTransport)transport.narrow(SslTransport.class);
IntrospectionSupport.setProperties(sslTransport, options);
Map<String, Object> socketOptions = IntrospectionSupport.extractProperties(options, "socket.");
sslTransport.setSocketOptions(socketOptions);
if (sslTransport.isTrace()) {
try {
transport = TransportLoggerFactory.getInstance().createTransportLogger(transport,
sslTransport.getLogWriterName(), sslTransport.isDynamicManagement(), sslTransport.isStartLogging(), sslTransport.getJmxPort());
} catch (Throwable e) {
LOG.error("Could not create TransportLogger object for: " + sslTransport.getLogWriterName() + ", reason: " + e, e);
}
}
transport = new InactivityMonitor(transport, format);
// Only need the WireFormatNegotiator if using openwire
if (format instanceof OpenWireFormat) {
transport = new WireFormatNegotiator(transport, (OpenWireFormat)format, sslTransport.getMinmumWireFormatVersion());
}
return transport;
return super.compositeConfigure(transport, format, options);
}
/**

View File

@ -66,8 +66,8 @@ public abstract class TransportBrokerTestSupport extends BrokerTest {
// instead use the original host name (typically localhost) to bind to
URI actualURI = connector.getServer().getConnectURI();
URI connectURI = new URI(actualURI.getScheme(), actualURI.getUserInfo(), bindURI.getHost(), actualURI.getPort(), actualURI.getPath(), actualURI
.getQuery(), actualURI.getFragment());
URI connectURI = new URI(actualURI.getScheme(), actualURI.getUserInfo(), bindURI.getHost(), actualURI.getPort(), actualURI.getPath(), bindURI
.getQuery(), bindURI.getFragment());
Transport transport = TransportFactory.connect(connectURI);
StubConnection connection = new StubConnection(transport);

View File

@ -16,6 +16,8 @@
*/
package org.apache.activemq.transport.tcp;
import java.net.URI;
import java.net.URISyntaxException;
import junit.framework.Test;
import junit.textui.TestRunner;
import org.apache.activemq.transport.TransportBrokerTestSupport;
@ -28,7 +30,12 @@ public class SslTransportBrokerTest extends TransportBrokerTestSupport {
public static final String TRUST_KEYSTORE = "src/test/resources/client.keystore";
protected String getBindLocation() {
return "ssl://localhost:0";
return "ssl://localhost:0?transport.soWriteTimeout=20000";
}
@Override
protected URI getBindURI() throws URISyntaxException {
return new URI("ssl://localhost:0?soWriteTimeout=20000");
}
protected void setUp() throws Exception {