Examples of ChannelDirectTcpip


Examples of com.jcraft.jsch.ChannelDirectTCPIP

        @Override
        public SshDirectTcpipChannel getDirectTcpipConnection(InetSocketAddress local, InetSocketAddress remote)
                throws IOException {
            Session session = getSession();

            ChannelDirectTCPIP directChannel;
            try {
                directChannel = (ChannelDirectTCPIP) session.openChannel("direct-tcpip");

                directChannel.setHost(InetAddresses.toAddrString(remote.getAddress()));
                directChannel.setPort(remote.getPort());

                directChannel.setOrgIPAddress(InetAddresses.toAddrString(local.getAddress()));
                directChannel.setOrgPort(local.getPort());

                channelCount++;
                directChannel.connect();
            } catch (JSchException e) {
                // TODO: Close session if it's failed??
                channelCount--;
                throw new IOException("Error opening direct-tcpip channel", e);
            }
View Full Code Here

Examples of com.jcraft.jsch.ChannelDirectTCPIP

                throws IOException {
            Session session = getSession();

            String bindAddress = InetAddresses.toAddrString(localAddress);
            int assignedPort;
            ChannelDirectTCPIP directChannel;
            try {
                int port = 0; // Auto asssign
                assignedPort = session.setPortForwardingL(bindAddress, port, remoteSocketAddress.getHostString(),
                        remoteSocketAddress.getPort());
View Full Code Here

Examples of org.apache.sshd.client.channel.ChannelDirectTcpip

        registerChannel(channel);
        return channel;
    }

    public ChannelDirectTcpip createDirectTcpipChannel(SshdSocketAddress local, SshdSocketAddress remote) throws IOException {
        ChannelDirectTcpip channel = new ChannelDirectTcpip(local, remote);
        registerChannel(channel);
        return channel;
    }
View Full Code Here

Examples of org.apache.sshd.client.channel.ChannelDirectTcpip

        getConnectionService().registerChannel(channel);
        return channel;
    }

    public ChannelDirectTcpip createDirectTcpipChannel(SshdSocketAddress local, SshdSocketAddress remote) throws IOException {
        ChannelDirectTcpip channel = new ChannelDirectTcpip(local, remote);
        getConnectionService().registerChannel(channel);
        return channel;
    }
View Full Code Here

Examples of org.apache.sshd.client.channel.ChannelDirectTcpip

        int forwardedPort = getFreePort();
        SshdSocketAddress local = new SshdSocketAddress("", forwardedPort);
        SshdSocketAddress remote = new SshdSocketAddress("localhost", echoPort);

        ChannelDirectTcpip channel = session.createDirectTcpipChannel(local, remote);
        channel.open().await();

        channel.getInvertedIn().write("Hello".getBytes());
        channel.getInvertedIn().flush();
        byte[] buf = new byte[1024];
        int n = channel.getInvertedOut().read(buf);
        String res = new String(buf, 0, n);
        assertEquals("Hello", res);
        channel.close(false);

        session.close(false).await();
    }
View Full Code Here

Examples of org.apache.sshd.client.channel.ChannelDirectTcpip

        getConnectionService().registerChannel(channel);
        return channel;
    }

    public ChannelDirectTcpip createDirectTcpipChannel(SshdSocketAddress local, SshdSocketAddress remote) throws IOException {
        ChannelDirectTcpip channel = new ChannelDirectTcpip(local, remote);
        getConnectionService().registerChannel(channel);
        return channel;
    }
View Full Code Here

Examples of org.apache.sshd.client.channel.ChannelDirectTcpip

        int forwardedPort = getFreePort();
        SshdSocketAddress local = new SshdSocketAddress("", forwardedPort);
        SshdSocketAddress remote = new SshdSocketAddress("localhost", echoPort);

        ChannelDirectTcpip channel = session.createDirectTcpipChannel(local, remote);
        channel.open().await();

        channel.getOut().write("Hello".getBytes());
        channel.getOut().flush();
        byte[] buf = new byte[1024];
        int n = channel.getIn().read(buf);
        String res = new String(buf, 0, n);
        assertEquals("Hello", res);
        channel.close(false);

        session.close(false).await();
    }
View Full Code Here

Examples of org.apache.sshd.client.channel.ChannelDirectTcpip

        getConnectionService().registerChannel(channel);
        return channel;
    }

    public ChannelDirectTcpip createDirectTcpipChannel(SshdSocketAddress local, SshdSocketAddress remote) throws IOException {
        ChannelDirectTcpip channel = new ChannelDirectTcpip(local, remote);
        getConnectionService().registerChannel(channel);
        return channel;
    }
View Full Code Here

Examples of org.apache.sshd.client.channel.ChannelDirectTcpip

        int forwardedPort = getFreePort();
        SshdSocketAddress local = new SshdSocketAddress("", forwardedPort);
        SshdSocketAddress remote = new SshdSocketAddress("localhost", echoPort);

        ChannelDirectTcpip channel = session.createDirectTcpipChannel(local, remote);
        channel.open().await();

        channel.getOut().write("Hello".getBytes());
        channel.getOut().flush();
        byte[] buf = new byte[1024];
        int n = channel.getIn().read(buf);
        String res = new String(buf, 0, n);
        assertEquals("Hello", res);
        channel.close(false);
    }
View Full Code Here

Examples of org.apache.sshd.client.channel.ChannelDirectTcpip

        registerChannel(channel);
        return channel;
    }

    public ChannelDirectTcpip createDirectTcpipChannel(SshdSocketAddress local, SshdSocketAddress remote) throws Exception {
        ChannelDirectTcpip channel = new ChannelDirectTcpip(local, remote);
        registerChannel(channel);
        return channel;
    }
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.