/**
*
* Copyright 2004 Protique Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
**/
package org.codehaus.activemq.transport.tcp;
import org.codehaus.activemq.ActiveMQConnection;
import org.codehaus.activemq.ActiveMQConnectionFactory;
import org.codehaus.activemq.broker.BrokerConnector;
import org.codehaus.activemq.broker.BrokerContainer;
import org.codehaus.activemq.broker.impl.BrokerConnectorImpl;
import org.codehaus.activemq.broker.impl.BrokerContainerImpl;
import org.codehaus.activemq.message.DefaultWireFormat;
import javax.jms.JMSException;
import java.io.IOException;
import java.net.Socket;
/**
* @version $Revision: 1.1 $
*/
public class ExceptionListener2Test extends ExceptionListenerTest {
public static final String URL = ActiveMQConnection.DEFAULT_URL;
protected BrokerContainer container;
protected void breakTransport() throws IOException, JMSException {
// lets set the timeout something small
TcpTransportChannel transport = (TcpTransportChannel) ((ActiveMQConnection) connection).getTransportChannel();
Socket socket = transport.getSocket();
socket.setSoTimeout(1000);
container.stop();
}
protected void setUp() throws Exception {
container = new BrokerContainerImpl(URL);
BrokerConnector brokerConnector = new BrokerConnectorImpl(container, URL, new DefaultWireFormat());
container.start();
super.setUp();
}
protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
return new ActiveMQConnectionFactory();
}
}