Package com.maverick.multiplex

Examples of com.maverick.multiplex.Request


            HashSet<Integer> activeTunnelIds = new HashSet<Integer>();

            // The agent keeps track of 'local' tunnels

            Request request = new Request(ACTIVE_LOCAL_TUNNELS);
            if (tunnel.sendRequest(request, true) && request.getRequestData()!=null) {

                ByteArrayReader reader = new ByteArrayReader(request.getRequestData());
                int count = (int) reader.readInt();
                for (int i = 0; i < count; i++) {
                    activeTunnelIds.add(new Integer((int) reader.readInt()));
                }
            }
View Full Code Here


            resource,
            policy);
          launchSession.checkAccessRights(null, agent.getSession());
                  if (resource.getType() == TransportType.LOCAL_TUNNEL_ID) {
                      try {
                          Request req = buildLocalTunnel(resource, launchSession);
                          request.setRequestData(req.getRequestData());
                        return true;
                      } catch (IOException ioe) {
                          throw new TunnelException(TunnelException.INTERNAL_ERROR, ioe);
                      }
                  } else if (resource.getType() == TransportType.REMOTE_TUNNEL_ID) {
View Full Code Here

        remoteTunnel.start();
    }
   
    void startLocalTunnel(AgentTunnel agent, Tunnel tunnel, LaunchSession launchSession) throws TunnelException {
        try {
            Request req = buildLocalTunnel(tunnel, launchSession);
            /* Only require replies if not running on the protocol thread. This allows autostart
             * tunnels to work without blocking
             */           
            if (!agent.sendRequest(req, Thread.currentThread() != agent.getThread())) {
                throw new TunnelException(TunnelException.AGENT_REFUSED_LOCAL_TUNNEL, (Throwable)null);
View Full Code Here

        msg.writeString(tunnel.getTransport());
        msg.writeString(tunnel.getSourceInterface());       
        msg.writeInt(tunnel.getSourcePort());
        msg.writeInt(tunnel.getDestination().getPort());
        msg.writeString(destHost);
        Request req = new Request(START_LOCAL_TUNNEL, msg.toByteArray());
        return req;

    }
View Full Code Here

        for (Tunnel tunnel : tunnels) {
            try {
                ByteArrayWriter msg = new ByteArrayWriter();
                msg.writeInt(tunnel.getResourceId());
                if (!agent.sendRequest(new Request(STOP_LOCAL_TUNNEL, msg.toByteArray()), false) && e == null) {
                    e = new TunnelException(TunnelException.AGENT_REFUSED_LOCAL_TUNNEL_STOP, (Throwable)null);
                }
            } catch (IOException ex) {
                throw new TunnelException(TunnelException.INTERNAL_ERROR, ex);
            }
View Full Code Here

    try {
      ByteArrayWriter msg = new ByteArrayWriter();
      msg.writeString(url.toExternalForm());
      msg.writeString(launchSession.getId());
      Request request = new Request("openURL", msg.toByteArray());
      if (agent.sendRequest(request, true)) {
        if(request.getRequestData()!=null) {
        ByteArrayReader rdr = new ByteArrayReader(request.getRequestData());
        return (int) rdr.readInt();
        }
      }

    } catch (Exception e) {
View Full Code Here

      agentsByAgentId.remove(tunnel.getId());
      agentsByLogonTicket.remove(tunnel.getSession().getLogonTicket());

      if (tunnel.isRunning()) {
        try {
          tunnel.sendRequest(new Request("shutdown", "".getBytes()), false, 10000);
        } catch (IOException e) {
          log.error("Failed to send shutdown request to agent. The agent may not be responding or the network link may now be down.",
            e);
        }
        tunnel.close();
View Full Code Here

        msg.writeInt(tunnel.getSourcePort());
        msg.writeString(destHost);
        msg.writeInt(tunnel.getDestination().getPort());
       
       
        Request request = new Request(TunnelingService.START_REMOTE_TUNNEL, msg.toByteArray());
        agent.sendRequest(request, false);
       
      } catch(IOException ex) {
        ex.printStackTrace();
      }
     
        running = true;
        if (log.isInfoEnabled())
            log.info("Starting remote listener on " + tunnel.getSourcePort());
        try {
            while (running) {
                try {
                    Socket s = listeningSocket.accept();
                    if (log.isInfoEnabled())
                        log.info("Received new connection on " + tunnel.getSourcePort() + " from " + s.getInetAddress());
                    RemoteForwardingChannel channel = new RemoteForwardingChannel(this, s, tunnel, launchSession);
                    try {
                        agent.openChannel(channel);
                    } catch (ChannelOpenException e) {
                        log.error("Error opening channel. Remote tunnel remaining open but closing connection.", e);
                        try {
                            s.close();
                        } catch (IOException ioe) {
                        }
                    }
                } catch (IOException e) {
                    if (running) {
                        log.error("IO error waiting for connection, stopping remote tunnel.", e);
                    }
                }
            }
        } finally {
         
        Request request = new Request(TunnelingService.STOP_REMOTE_TUNNEL, msg.toByteArray());
        try {
        agent.sendRequest(request, false);
      } catch (IOException e) {
      }
       
View Full Code Here

        msg.writeString(message.getContent());

        DefaultAgentManager agentManager = DefaultAgentManager.getInstance();
        if (agentManager.hasActiveAgent(info) && info.getUser().getPrincipalName().equals(recipient.getRecipientAlias())) {
            try {
                Request request = new Request("agentMessage", msg.toByteArray());
                AgentTunnel tunnel = agentManager.getAgentBySession(info);
                if (tunnel != null) {
                    tunnel.sendRequest(request, false, 0);
                    return true;
                }
View Full Code Here

        new Properties(),
        shortcut.getParameters(),
        shortcut.getApplication()));
    }
   
    return new Request("launchApplication", msg.toByteArray());
  }
View Full Code Here

TOP

Related Classes of com.maverick.multiplex.Request

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.