Package org.exolab.jms.net.uri

Examples of org.exolab.jms.net.uri.URI


     * @throws Exception for any error
     */
    protected ConnectionRequestInfo getManagedConnectionRequestInfo()
            throws Exception {
        TCPSRequestInfo info =
                new TCPSRequestInfo(new URI("tcps://localhost:5099"));
        SSLProperties properties =
                SSLUtil.getSSLProperties("test.keystore", "secret");
        info.setSSLProperties(properties);
        return info;
    }
View Full Code Here


     * @throws Exception for any error
     */
    public SocketManagedConnectionFactoryTestCase(String name, String uri)
            throws Exception {
        super(name);
        _uri = new URI(uri);
    }
View Full Code Here

     * cannot be reached.
     *
     * @throws Exception for any error
     */
    public void testAlternativeURI() throws Exception {
        URI uri = new URI(_uri);
        uri.setHost("anonexistenthost1");
        checkAlternativeURI(uri, _uri.getHost());
    }
View Full Code Here

     * to the primary URI.
     *
     * @throws Exception for any error
     */
    public void testAlternativeURIWithSecMgr() throws Exception {
        final URI uri= new URI(_uri);
        uri.setHost("anonexistenthost2");

        SecurityManager manager = new SecurityManager() {
            public void checkConnect(String host, int port) {
                if (host.equals(uri.getHost()) && port == uri.getPort()) {
                    throw new SecurityException(
                            "Cant connect to " + host + ":" + port);
                }
                // let everthing else connect
            }
View Full Code Here

        if (InetAddress.getLocalHost().getHostAddress().equals(loopbackIP)) {
            fail("Local host address must not be the same as "
                 + loopbackIP + " in order for this test case to run");

        }
        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);
View Full Code Here

        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);
View Full Code Here

     *
     * @return an unused acceptor URI
     * @throws Exception for any error
     */
    protected URI getUnusedURI() throws Exception {
        URI result = new URI(_uri);
        result.setHost("someinvalidhostname");
        return result;
    }
View Full Code Here

     * @param alternativeHost the alternative host to connect to
     * @throws Exception for any error
     */
    private void checkAlternativeURI(URI uri, String alternativeHost)
            throws Exception {
        URI successURI = new URI(uri);
        successURI.setHost(alternativeHost);
        SocketRequestInfo acceptInfo = getSocketRequestInfo(successURI);

        SocketRequestInfo failInfo = getSocketRequestInfo(uri);
        // connections to this should fail

        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(
View Full Code Here

                                     ManagedConnectionFactory factory,
                                     String connectURI, String acceptURI)
        throws Exception {
        super(name);
        _mcf = factory;
        _connectURI = new URI(connectURI);
        _acceptURI = new URI(acceptURI);
    }
View Full Code Here

        ConnectionManager manager = initConnectionManagers(null);
        ConnectionFactory factory = _mcf.createConnectionFactory(manager);
        assertTrue(factory.canConnect(_connectURI));

        // make sure an invalid URI returns false
        URI invalid = new URI("xxx://");
        assertFalse(factory.canConnect(invalid));
    }
View Full Code Here

TOP

Related Classes of org.exolab.jms.net.uri.URI

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.