Package com.atlassian.localtunnel.util

Examples of com.atlassian.localtunnel.util.SocketJoiner


            exec.execute(new Runnable()
            {
                @Override
                public void run()
                {
                    SocketJoiner joiner = null;
                    try
                    {
                        while (!exec.isShutdown())
                        {
                            Socket proxy = new Socket(backend.getHost(), backend.getPort());
                            protocol.sendVersion(proxy);

                            protocol.sendMessage(proxy, protocol.proxyRequest(tunnelName, clientName));
                            String message = protocol.receiveMessage(proxy);

                            if (null != message && !"".equals(message))
                            {
                                Gson gson = new Gson();
                                Map result = gson.fromJson(message, Map.class);

                                if (null != result && null != result.get("proxy") && (Boolean) result.get("proxy"))
                                {
                                    Socket local = new Socket("0.0.0.0", port);
                                    joiner = new SocketJoiner(proxy, local);
                                    joiner.join();
                                }
                            }
                        }
                        if (null != joiner)
                        {
                            joiner.stop();
                        }
                    }
                    catch (IOException e)
                    {
                        if (null != joiner)
                        {
                            joiner.stop();
                        }
                    }
                }
            });
        }
View Full Code Here

TOP

Related Classes of com.atlassian.localtunnel.util.SocketJoiner

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.