Package org.exolab.jms.net.connector

Examples of org.exolab.jms.net.connector.ManagedConnectionAcceptor


        SocketRequestInfo successInfo = getSocketRequestInfo(uri);
        successInfo.setAlternativeHost(successURI.getHost());
        // connections to this should succeed (on second attempt)

        // create the acceptor
        ManagedConnectionAcceptor acceptor = createAcceptor(null, acceptInfo);
        TestAcceptorEventListener listener = new TestAcceptorEventListener(
                new TestInvocationHandler());
        acceptor.accept(listener);

        // verify that a connection can't be established to uri
        try {
            createConnection(null, failInfo);
            fail("Expected connection to " + uri + " to fail");
        } catch (ResourceException exception) {
            // the expected behaviour
        }

        // verify that a connection can be established via the alternative URI
        ManagedConnection connection = null;
        try {
            connection = createConnection(null, successInfo);
        } catch (Exception exception) {
            fail("Expected connections to " + successURI + " to succeed:" +
                 exception);
        }

        // clean up
        connection.destroy();
        acceptor.close();
    }
View Full Code Here


     * @throws ResourceException for any error
     */
    public ManagedConnectionAcceptor matchManagedConnectionAcceptors(
            List acceptors, ConnectionRequestInfo info)
            throws ResourceException {
        ManagedConnectionAcceptor result = null;

        if (info instanceof SocketRequestInfo) {
            Iterator iterator = acceptors.iterator();
            while (iterator.hasNext()) {
                SocketManagedConnectionAcceptor acceptor =
View Full Code Here

        URI loopback = URIHelper.create(scheme, loopbackIP, port);
        SocketRequestInfo acceptInfo = getSocketRequestInfo(loopback);
        acceptInfo.setBindAll(false);

        // create the acceptor
        ManagedConnectionAcceptor acceptor
                = createAcceptor(null, acceptInfo);
        TestAcceptorEventListener listener = new TestAcceptorEventListener(
                new TestInvocationHandler());
        acceptor.accept(listener);

        // connections to this should fail
        String host = InetAddress.getLocalHost().getHostName();
        URI localhost = URIHelper.create(scheme, host, port);
        SocketRequestInfo failInfo = getSocketRequestInfo(localhost);

        // verify that a connection can't be established
        try {
            createConnection(null, failInfo);
            fail("Expected connection to " + localhost + " to fail");
        } catch (ResourceException exception) {
            // the expected behaviour
        }

        // verify that a connection can be established via the loopback URI
        SocketRequestInfo info = getSocketRequestInfo(loopback);
        ManagedConnection connection = null;
        try {
            connection = createConnection(null, info);
        } catch (Exception exception) {
            fail("Expected connections to " + loopback + " to succeed:" +
                 exception);
        }

        // clean up
        connection.destroy();

        // NB: the ServerSocket doesn't seem to close down under JDK 1.3.1
        //  and 1.4.1 if the accepted sockets aren't closed first.
        // This only happens when the ServerSocket is bound to a single address
        listener.destroy();

        acceptor.close();
    }
View Full Code Here

     */
    public void testMatchManagedConnectionsWithAlternativeURI()
            throws Exception {
        // create the acceptor
        SocketRequestInfo info = getSocketRequestInfo(_uri);
        ManagedConnectionAcceptor acceptor = createAcceptor(null, info);
        TestAcceptorEventListener listener = new TestAcceptorEventListener(
                new TestInvocationHandler());
        acceptor.accept(listener);

        // create a connection
        List connections = new ArrayList();
        ManagedConnection connection = connection = createConnection(null, info);
        connections.add(connection);

        // verify connection matching
        ManagedConnectionFactory factory = getManagedConnectionFactory();
        ManagedConnection match = null;

        // make sure that the created connection matches the info used
        // to establish it
        match = factory.matchManagedConnections(connections, null, info);
        assertEquals(connection, match);

        // make sure connection matching works when the alternative URI
        // is the same as the acceptors.
        URI failURI = getUnusedURI();
        SocketRequestInfo altInfo = getSocketRequestInfo(failURI);
        altInfo.setAlternativeHost(_uri.getHost());

        // make sure there is no match when none of the URIs are the same.
        SocketRequestInfo failInfo = getSocketRequestInfo(failURI);
        match = factory.matchManagedConnections(connections, null, failInfo);
        assertNull(match);

        // clean up
        acceptor.close();
        listener.destroy();
        connection.destroy();
    }
View Full Code Here

     * @throws ResourceException for any error
     */
    public ManagedConnectionAcceptor matchManagedConnectionAcceptors(
            List acceptors, ConnectionRequestInfo info)
            throws ResourceException {
        ManagedConnectionAcceptor result = null;

        if (info instanceof URIRequestInfo) {
            URIRequestInfo requestInfo = (URIRequestInfo) info;
            URI uri = requestInfo.getURI();
            Iterator iterator = acceptors.iterator();
View Full Code Here

     * @throws ResourceException for any error
     */
    public ManagedConnectionAcceptor matchManagedConnectionAcceptors(
            List acceptors, ConnectionRequestInfo info)
            throws ResourceException {
        ManagedConnectionAcceptor result = null;

        if (info instanceof RMIRequestInfo) {
            RMIRequestInfo requestInfo = (RMIRequestInfo) info;
            URI uri = URIHelper.convertHostToAddress(requestInfo.getURI());
            Iterator iterator = acceptors.iterator();
View Full Code Here

     * @throws ResourceException for any error
     */
    public ManagedConnectionAcceptor matchManagedConnectionAcceptors(
            List acceptors, ConnectionRequestInfo info)
            throws ResourceException {
        ManagedConnectionAcceptor result = null;

        if (info instanceof SocketRequestInfo) {
            Iterator iterator = acceptors.iterator();
            while (iterator.hasNext()) {
                SocketManagedConnectionAcceptor acceptor =
View Full Code Here

TOP

Related Classes of org.exolab.jms.net.connector.ManagedConnectionAcceptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.