mirror of https://github.com/apache/activemq.git
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:
parent
86f3da3f83
commit
12838c2811
|
@ -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) {
|
public Transport compositeConfigure(Transport transport, WireFormat format, Map options) {
|
||||||
|
|
||||||
SslTransport sslTransport = (SslTransport)transport.narrow(SslTransport.class);
|
SslTransport sslTransport = (SslTransport)transport.narrow(SslTransport.class);
|
||||||
IntrospectionSupport.setProperties(sslTransport, options);
|
IntrospectionSupport.setProperties(sslTransport, options);
|
||||||
|
|
||||||
Map<String, Object> socketOptions = IntrospectionSupport.extractProperties(options, "socket.");
|
return super.compositeConfigure(transport, format, options);
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -66,8 +66,8 @@ public abstract class TransportBrokerTestSupport extends BrokerTest {
|
||||||
// instead use the original host name (typically localhost) to bind to
|
// instead use the original host name (typically localhost) to bind to
|
||||||
|
|
||||||
URI actualURI = connector.getServer().getConnectURI();
|
URI actualURI = connector.getServer().getConnectURI();
|
||||||
URI connectURI = new URI(actualURI.getScheme(), actualURI.getUserInfo(), bindURI.getHost(), actualURI.getPort(), actualURI.getPath(), actualURI
|
URI connectURI = new URI(actualURI.getScheme(), actualURI.getUserInfo(), bindURI.getHost(), actualURI.getPort(), actualURI.getPath(), bindURI
|
||||||
.getQuery(), actualURI.getFragment());
|
.getQuery(), bindURI.getFragment());
|
||||||
|
|
||||||
Transport transport = TransportFactory.connect(connectURI);
|
Transport transport = TransportFactory.connect(connectURI);
|
||||||
StubConnection connection = new StubConnection(transport);
|
StubConnection connection = new StubConnection(transport);
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.activemq.transport.tcp;
|
package org.apache.activemq.transport.tcp;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
import junit.textui.TestRunner;
|
import junit.textui.TestRunner;
|
||||||
import org.apache.activemq.transport.TransportBrokerTestSupport;
|
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";
|
public static final String TRUST_KEYSTORE = "src/test/resources/client.keystore";
|
||||||
|
|
||||||
protected String getBindLocation() {
|
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 {
|
protected void setUp() throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue