Package de.fhkn.in.uce.stun.message

Examples of de.fhkn.in.uce.stun.message.Message.addAttribute()


        if (privateAddress instanceof Inet6Address) {
            registerMessage.addAttribute(new XorMappedAddress(new InetSocketAddress(this.socketToMediator
                    .getLocalAddress(), this.socketToMediator.getLocalPort()), ByteBuffer.wrap(
                    registerMessage.getHeader().getTransactionId()).getInt()));
        } else {
            registerMessage.addAttribute(new XorMappedAddress(new InetSocketAddress(this.socketToMediator
                    .getLocalAddress(), this.socketToMediator.getLocalPort())));
        }
        final MessageWriter messageWriter = new MessageWriter(this.socketToMediator.getOutputStream());
        logger.info("Sending RegisterMessage for {}", this.targetId); //$NON-NLS-1$
        messageWriter.writeMessage(registerMessage);
View Full Code Here


    }

    private void sendConnectionRequestResponse(final Socket controlConnection, final Message connectionRequest)
            throws Exception {
        final Message response = connectionRequest.buildSuccessResponse();
        response.addAttribute(new HolePunchingAttribute());
        // add private endpoint
        final InetAddress privateAddress = controlConnection.getLocalAddress();
        if (privateAddress instanceof Inet6Address) {
            response.addAttribute(new XorMappedAddress(new InetSocketAddress(controlConnection.getLocalAddress(),
                    controlConnection.getLocalPort()), ByteBuffer.wrap(response.getHeader().getTransactionId())
View Full Code Here

        final Message response = connectionRequest.buildSuccessResponse();
        response.addAttribute(new HolePunchingAttribute());
        // add private endpoint
        final InetAddress privateAddress = controlConnection.getLocalAddress();
        if (privateAddress instanceof Inet6Address) {
            response.addAttribute(new XorMappedAddress(new InetSocketAddress(controlConnection.getLocalAddress(),
                    controlConnection.getLocalPort()), ByteBuffer.wrap(response.getHeader().getTransactionId())
                    .getInt()));
        } else {
            response.addAttribute(new XorMappedAddress(new InetSocketAddress(controlConnection.getLocalAddress(),
                    controlConnection.getLocalPort())));
View Full Code Here

        if (privateAddress instanceof Inet6Address) {
            response.addAttribute(new XorMappedAddress(new InetSocketAddress(controlConnection.getLocalAddress(),
                    controlConnection.getLocalPort()), ByteBuffer.wrap(response.getHeader().getTransactionId())
                    .getInt()));
        } else {
            response.addAttribute(new XorMappedAddress(new InetSocketAddress(controlConnection.getLocalAddress(),
                    controlConnection.getLocalPort())));
        }
        response.writeTo(controlConnection.getOutputStream());
        logger.debug("Connection request response send"); //$NON-NLS-1$
    }
View Full Code Here

    private void sendConnectionRequest(final Socket controlConnection, final String targetId,
            final Token authentificationToken) throws IOException {
        final MessageWriter messageWriter = new MessageWriter(controlConnection.getOutputStream());
        final Message connectionRequestMessage = MessageStaticFactory.newSTUNMessageInstance(STUNMessageClass.REQUEST,
                STUNMessageMethod.CONNECTION_REQUEST);
        connectionRequestMessage.addAttribute(new HolePunchingAttribute());
        connectionRequestMessage.addAttribute(new Username(targetId));
        final InetSocketAddress localAddress = (InetSocketAddress) controlConnection.getLocalSocketAddress();
        connectionRequestMessage.addAttribute(new XorMappedAddress(localAddress));
        connectionRequestMessage.addAttribute(authentificationToken);
        messageWriter.writeMessage(connectionRequestMessage);
View Full Code Here

            final Token authentificationToken) throws IOException {
        final MessageWriter messageWriter = new MessageWriter(controlConnection.getOutputStream());
        final Message connectionRequestMessage = MessageStaticFactory.newSTUNMessageInstance(STUNMessageClass.REQUEST,
                STUNMessageMethod.CONNECTION_REQUEST);
        connectionRequestMessage.addAttribute(new HolePunchingAttribute());
        connectionRequestMessage.addAttribute(new Username(targetId));
        final InetSocketAddress localAddress = (InetSocketAddress) controlConnection.getLocalSocketAddress();
        connectionRequestMessage.addAttribute(new XorMappedAddress(localAddress));
        connectionRequestMessage.addAttribute(authentificationToken);
        messageWriter.writeMessage(connectionRequestMessage);
    }
View Full Code Here

        final Message connectionRequestMessage = MessageStaticFactory.newSTUNMessageInstance(STUNMessageClass.REQUEST,
                STUNMessageMethod.CONNECTION_REQUEST);
        connectionRequestMessage.addAttribute(new HolePunchingAttribute());
        connectionRequestMessage.addAttribute(new Username(targetId));
        final InetSocketAddress localAddress = (InetSocketAddress) controlConnection.getLocalSocketAddress();
        connectionRequestMessage.addAttribute(new XorMappedAddress(localAddress));
        connectionRequestMessage.addAttribute(authentificationToken);
        messageWriter.writeMessage(connectionRequestMessage);
    }

    private Message receiveMessage(final Socket controlConnection) throws IOException {
View Full Code Here

                STUNMessageMethod.CONNECTION_REQUEST);
        connectionRequestMessage.addAttribute(new HolePunchingAttribute());
        connectionRequestMessage.addAttribute(new Username(targetId));
        final InetSocketAddress localAddress = (InetSocketAddress) controlConnection.getLocalSocketAddress();
        connectionRequestMessage.addAttribute(new XorMappedAddress(localAddress));
        connectionRequestMessage.addAttribute(authentificationToken);
        messageWriter.writeMessage(connectionRequestMessage);
    }

    private Message receiveMessage(final Socket controlConnection) throws IOException {
        final MessageReader messageReader = this.hpUtil.getCustomHolePunchingMessageReader();
View Full Code Here

        final MessageWriter messageWriter = new MessageWriter(toBeAuthenticated.getOutputStream());
        final MessageReader messageReader = this.hpUtil.getCustomHolePunchingMessageReader();
        // sending authentication message
        final Message authenticationMessage = MessageStaticFactory.newSTUNMessageInstance(STUNMessageClass.REQUEST,
                STUNMessageMethod.AUTHENTICATE);
        authenticationMessage.addAttribute(new Token(this.authentikationToken));
        logger.info("Sending AuthenticationMessage: {}", authenticationMessage); //$NON-NLS-1$
        messageWriter.writeMessage(authenticationMessage);
        // receiving authentication acknowledgment message
        final Message reveivedAckMessage = messageReader.readSTUNMessage(toBeAuthenticated.getInputStream());
        if (this.hpUtil.isAuthenticationAcknowledgmentMessage(reveivedAckMessage)) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.