Package org.apache.sshd.common.future

Examples of org.apache.sshd.common.future.CloseFuture


        ClientChannel channel = session.createChannel(ClientChannel.CHANNEL_SHELL);
        channel.setIn(new ByteArrayInputStream(new byte[0]));
        channel.setOut(new ByteArrayOutputStream());
        channel.setErr(new ByteArrayOutputStream());
        OpenFuture openFuture = channel.open();
        CloseFuture closeFuture = session.close(true);
        channelLatch.countDown();
        openFuture.await();
        closeFuture.await();
        assertNotNull(openFuture.getException());
        assertTrue(closeFuture.isClosed());
    }
View Full Code Here


        start();
    }

    public CloseFuture close(final boolean immediately) {
        stopSessionTimeoutListener();
        CloseFuture future;
        if (acceptor != null) {
            future = CloseableUtils.sequential(acceptor, ioServiceFactory).close(immediately);
        } else if (ioServiceFactory != null) {
            future = ioServiceFactory.close(immediately);
        } else {
            future = CloseableUtils.closed();
        }
        future.addListener(new SshFutureListener<CloseFuture>() {
            public void operationComplete(CloseFuture future) {
                acceptor = null;
                ioServiceFactory = null;
                if (shutdownExecutor && executor != null) {
                    executor.shutdown();
View Full Code Here

    public void open() throws IOException {
        start();
    }

    public CloseFuture close(boolean immediately) {
        CloseFuture future;
        if (connector != null) {
            future = CloseableUtils.sequential(connector, ioServiceFactory).close(immediately);
        } else if (ioServiceFactory != null) {
            future = ioServiceFactory.close(immediately);
        } else {
            future = CloseableUtils.closed();
        }
        future.addListener(new SshFutureListener<CloseFuture>() {
            public void operationComplete(CloseFuture future) {
                connector = null;
                ioServiceFactory = null;
                if (shutdownExecutor && executor != null) {
                    executor.shutdown();
View Full Code Here

    public void testCloseBeforeAuthSucceed() throws Exception {
        SshClient client = SshClient.setUpDefaultClient();
        client.start();
        ClientSession session = client.connect("localhost", port).await().getSession();
        AuthFuture authFuture = session.authPassword("smx", "smx");
        CloseFuture closeFuture = session.close(false);
        authFuture.await();
        closeFuture.await();
        assertNotNull(authFuture.getException());
        assertTrue(closeFuture.isClosed());
    }
View Full Code Here

        ClientChannel channel = session.createChannel(ClientChannel.CHANNEL_SHELL);
        channel.setIn(new ByteArrayInputStream(new byte[0]));
        channel.setOut(new ByteArrayOutputStream());
        channel.setErr(new ByteArrayOutputStream());
        OpenFuture openFuture = channel.open();
        CloseFuture closeFuture = session.close(false);
        openFuture.await();
        closeFuture.await();
        assertNotNull(openFuture.isOpened());
        assertTrue(closeFuture.isClosed());
    }
View Full Code Here

        ClientChannel channel = session.createChannel(ClientChannel.CHANNEL_SHELL);
        channel.setIn(new ByteArrayInputStream(new byte[0]));
        channel.setOut(new ByteArrayOutputStream());
        channel.setErr(new ByteArrayOutputStream());
        OpenFuture openFuture = channel.open();
        CloseFuture closeFuture = session.close(true);
        openFuture.await();
        closeFuture.await();
        assertNotNull(openFuture.getException());
        assertTrue(closeFuture.isClosed());
    }
View Full Code Here

        out = new ChannelOutputStream(this, remoteWindow, log, SshConstants.Message.SSH_MSG_CHANNEL_DATA);
    }

    @Override
    protected synchronized CloseFuture preClose(boolean immediately) {
        final CloseFuture future = new DefaultCloseFuture(null);
        serverSession.close(immediately).addListener(new SshFutureListener<IoCloseFuture>() {
            public void operationComplete(IoCloseFuture f) {
                future.setClosed();
            }
        });
        return future;
    }
View Full Code Here

        authLatch = new CountDownLatch(1);
        SshClient client = SshClient.setUpDefaultClient();
        client.start();
        ClientSession session = client.connect("localhost", port).await().getSession();
        AuthFuture authFuture = session.authPassword("smx", "smx");
        CloseFuture closeFuture = session.close(false);
        authLatch.countDown();
        authFuture.await();
        closeFuture.await();
        assertNotNull(authFuture.getException());
        assertTrue(closeFuture.isClosed());
    }
View Full Code Here

        ClientChannel channel = session.createChannel(ClientChannel.CHANNEL_SHELL);
        channel.setIn(new ByteArrayInputStream(new byte[0]));
        channel.setOut(new ByteArrayOutputStream());
        channel.setErr(new ByteArrayOutputStream());
        OpenFuture openFuture = channel.open();
        CloseFuture closeFuture = session.close(false);
        openFuture.await();
        closeFuture.await();
        assertTrue(openFuture.isOpened());
        assertTrue(closeFuture.isClosed());
    }
View Full Code Here

        ClientChannel channel = session.createChannel(ClientChannel.CHANNEL_SHELL);
        channel.setIn(new ByteArrayInputStream(new byte[0]));
        channel.setOut(new ByteArrayOutputStream());
        channel.setErr(new ByteArrayOutputStream());
        OpenFuture openFuture = channel.open();
        CloseFuture closeFuture = session.close(true);
        channelLatch.countDown();
        openFuture.await();
        closeFuture.await();
        assertNotNull(openFuture.getException());
        assertTrue(closeFuture.isClosed());
    }
View Full Code Here

TOP

Related Classes of org.apache.sshd.common.future.CloseFuture

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.