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

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


        final ConnectionRequest connReq = this.connectionRequests.getConnectionRequest(new String(message.getHeader()
                .getTransactionId()));
        final Message successResponse = connReq.getConnectionRequestMessage().buildSuccessResponse();
        final XorMappedAddress endpointAtRelay = message.getAttribute(XorMappedAddress.class);
        successResponse.addAttribute(endpointAtRelay);
        successResponse.writeTo(connReq.getControlConnection().getOutputStream());
    }

    private void callTarget(final UserData target, final Message connectionRequestFromSource) throws Exception {
        final Socket toTarget = target.getSocketToUser();
        logger.debug("Calling target {}", toTarget.toString());
View Full Code Here


        final Socket toTarget = target.getSocketToUser();
        logger.debug("Calling target {}", toTarget.toString());
        final Message connectionRequest = MessageStaticFactory.newSTUNMessageInstance(STUNMessageClass.REQUEST,
                STUNMessageMethod.CONNECTION_REQUEST, connectionRequestFromSource.getHeader().getTransactionId());
        connectionRequest.addAttribute(new RelayingAttribute());
        connectionRequest.writeTo(toTarget.getOutputStream());
        // return this.waitForTarget(toTarget);
    }

    private void sendFailureResponse(final Message message, final String errorReaon, final STUNErrorCode errorCode,
            final OutputStream out) throws Exception {
View Full Code Here

    private void sendFailureResponse(final Message message, final String errorReaon, final STUNErrorCode errorCode,
            final OutputStream out) throws Exception {
        logger.debug(errorReaon);
        final Message failureResponse = message.buildFailureResponse(errorCode, errorReaon);
        failureResponse.writeTo(out);
    }

    @Override
    public NATTraversalTechniqueAttribute getAttributeForTraversalTechnique() {
        return new RelayingAttribute();
View Full Code Here

        final Message requestMessage = MessageStaticFactory.newSTUNMessageInstance(STUNMessageClass.REQUEST,
                STUNMessageMethod.CONNECTION_REQUEST);
        requestMessage.addAttribute(new Username(targetId));
        requestMessage.addAttribute(new ReversalAttribute());
        logger.info("send connection request for target {}", targetId); //$NON-NLS-1$
        requestMessage.writeTo(controlConnection.getOutputStream());
    }
}
View Full Code Here

    private void sendSuccessResponse(final Socket controlConnection, final Message request) throws IOException {
        logger.debug("Sending success response"); //$NON-NLS-1$
        final Message response = request.buildSuccessResponse();
        response.addAttribute(new ReversalAttribute());
        response.writeTo(controlConnection.getOutputStream());
    }

    private void sendFailureResponse(final Socket controlConnection, final Message request, final String errorReason)
            throws IOException {
        logger.debug(errorReason);
View Full Code Here

    private void sendFailureResponse(final Socket controlConnection, final Message request, final String errorReason)
            throws IOException {
        logger.debug(errorReason);
        final Message response = request.buildFailureResponse(STUNErrorCode.BAD_REQUEST, errorReason);
        response.writeTo(controlConnection.getOutputStream());
    }

    /**
     * waits for the correct response message of the request messages from
     * parameter. After receiving message or a timeout this method returns true
View Full Code Here

        successResponse.addAttribute(this.createXorMappedAddressFromSocket(controlConnection, successResponse
                .getHeader().getTransactionId()));
        // private endpoint
        successResponse.addAttribute(message.getAttribute(XorMappedAddress.class));
        logger.debug("Sending connection request response to {}", connReq.getControlConnection().toString()); //$NON-NLS-1$
        successResponse.writeTo(connReq.getControlConnection().getOutputStream());
    }

    private void forwardConnectionRequest(final UserData target, final Message connectionRequestFromSource,
            final Socket controlConnectionToSource) throws Exception {
        final Socket toTarget = target.getSocketToUser();
View Full Code Here

        connectionRequest.addAttribute(this.createXorMappedAddressFromSocket(controlConnectionToSource,
                connectionRequest.getHeader().getTransactionId()));
        // private endpoint
        connectionRequest.addAttribute(connectionRequestFromSource.getAttribute(XorMappedAddress.class));
        logger.debug("Forwarding endpoints to target {}", toTarget.toString()); //$NON-NLS-1$
        connectionRequest.writeTo(toTarget.getOutputStream());
    }

    private void sendFailureResponse(final Message message, final String errorReaon, final STUNErrorCode errorCode,
            final OutputStream out) throws Exception {
        logger.debug(errorReaon);
View Full Code Here

    private void sendFailureResponse(final Message message, final String errorReaon, final STUNErrorCode errorCode,
            final OutputStream out) throws Exception {
        logger.debug(errorReaon);
        final Message failureResponse = message.buildFailureResponse(errorCode, errorReaon);
        failureResponse.writeTo(out);
    }

    private XorMappedAddress createXorMappedAddressFromSocket(final Socket socket, final byte[] transactionid) {
        XorMappedAddress result;
        if (socket.getInetAddress() instanceof Inet6Address) {
View Full Code Here

    private NATBehavior requestTargetNatBehavior(final String targetId) throws Exception {
        NATBehavior result = new NATBehavior();
        final Message requestMessage = MessageStaticFactory.newSTUNMessageInstance(STUNMessageClass.REQUEST,
                STUNMessageMethod.NAT_REQUEST);
        requestMessage.addAttribute(new Username(targetId));
        requestMessage.writeTo(this.mediatorConnection.getControlConnection().getOutputStream());
        final MessageReader messageReader = MessageReader
                .createMessageReaderWithCustomAttributeTypeDecoder(new NATAttributeTypeDecoder());
        final Message response = messageReader.readSTUNMessage(this.mediatorConnection.getControlConnection()
                .getInputStream());
        if (response.hasAttribute(NATBehavior.class)) {
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.