Package de.fhkn.in.uce.holepunching.core

Examples of de.fhkn.in.uce.holepunching.core.HolePuncher$ConnectorTask


        this.hpUtil = HolePunchingUtil.getInstance();
        this.socketToMediator = socketToMediator;
        final SocketAddress localSocketAddress = new InetSocketAddress(port);
        this.connectionListener = new ConnectionListener(socketToMediator.getLocalAddress(),
                socketToMediator.getLocalPort());
        this.hp = new HolePuncher(this.connectionListener, localSocketAddress, socketQueue);
        this.endpoints = endpoints;
        this.authentificationToken = authentificationToken;
    }
View Full Code Here


        final InetSocketAddress localAddress = (InetSocketAddress) controlConnection.getLocalSocketAddress();
        final ConnectionListener connectionListener = new ConnectionListener(localAddress.getAddress(),
                localAddress.getPort());
        logger.debug("Starting hole puncher"); //$NON-NLS-1$
        final SourceConnectionAuthenticator authentification = new SourceConnectionAuthenticator(token.getToken());
        final HolePuncher hp = new HolePuncher(connectionListener, localAddress, socketQueue);
        this.startHolePunching(addresses, authentification, hp);
        boolean interrupted = false;
        try {
            while (result == null) {
                try {
                    result = socketQueue.take();
                } catch (final InterruptedException e) {
                    interrupted = true;
                    // fall through and retry
                    logger.info("InterruptedException (fall through and retry)");
                }
            }
        } finally {
            if (interrupted) {
                Thread.currentThread().interrupt();
            }
        }
        connectionListener.shutdown();
        hp.shutdownNow();
        // received dummy socket for indicating time limit exceeded
        if (!result.isConnected()) {
            throw new IOException("Could not get socket to: " + targetId);
        }
        logger.info("Returning socket: {}", result);
View Full Code Here

TOP

Related Classes of de.fhkn.in.uce.holepunching.core.HolePuncher$ConnectorTask

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.