Package net.schmizz.sshj.connection

Examples of net.schmizz.sshj.connection.ConnectionException


   public void testDontThrowIOExceptionOnClear() throws Exception {
      SshjSshClient ssh1 = createClient();
      SSHClient ssh = createMock(SSHClient.class);
      expect(ssh.isConnected()).andReturn(true);
      ssh.disconnect();
      expectLastCall().andThrow(new ConnectionException("disconnected"));
      replay(ssh);
      ssh1.sshClientConnection.ssh = ssh;
      ssh1.sshClientConnection.clear();
      verify(ssh);
   }
View Full Code Here


   public void testRetriesLoggedAtInfoWithCount() throws Exception {
      SSHClientConnection mockConnection = createMock(SSHClientConnection.class);
      net.schmizz.sshj.SSHClient mockClient = createMock(net.schmizz.sshj.SSHClient.class);

      mockConnection.clear(); expectLastCall();
      mockConnection.create(); expectLastCall().andThrow(new ConnectionException("test1"));
      mockConnection.clear(); expectLastCall();
      //currently does two clears, one on failure (above) and one on next iteration (below)
      mockConnection.clear(); expectLastCall();
      mockConnection.create(); expectLastCall().andReturn(mockClient);
      replay(mockConnection);
View Full Code Here

    private void gotOpenConfirmation(SSHPacket buf)
            throws ConnectionException {
        try {
            init(buf.readUInt32AsInt(), buf.readUInt32(), buf.readUInt32());
        } catch (Buffer.BufferException be) {
            throw new ConnectionException(be);
        }
        openEvent.set();
    }
View Full Code Here

    private void gotOpenFailure(SSHPacket buf)
            throws ConnectionException {
        try {
            openEvent.deliverError(new OpenFailException(getType(), buf.readUInt32AsInt(), buf.readString()));
        } catch (Buffer.BufferException be) {
            throw new ConnectionException(be);
        }
        finishOff();
    }
View Full Code Here

                exitErrMsg = buf.readString();
                sendClose();
            } else
                super.handleRequest(req, buf);
        } catch (Buffer.BufferException be) {
            throw new ConnectionException(be);
        }
    }
View Full Code Here

        try {
            final int dataTypeCode = buf.readUInt32AsInt();
            if (dataTypeCode == 1)
                receiveInto(err, buf);
            else
                throw new ConnectionException(DisconnectReason.PROTOCOL_ERROR,
                                              "Bad extended data type = " + dataTypeCode);
        } catch (Buffer.BufferException be) {
            throw new ConnectionException(be);
        }
    }
View Full Code Here

            throws SSHException {
        if (closed) {
            if (error != null)
                throw error;
            else
                throw new ConnectionException("Stream closed");
        }
    }
View Full Code Here

    }

    public void receive(byte[] data, int offset, int len)
            throws ConnectionException, TransportException {
        if (eof)
            throw new ConnectionException("Getting data on EOF'ed stream");
        synchronized (buf) {
            buf.putRawBytes(data, offset, len);
            buf.notifyAll();
        }
        win.consume(len);
View Full Code Here

        SSHPacket reply = req(PF_REQ, forward);
        if (forward.port == 0)
            try {
                forward.port = reply.readUInt32AsInt();
            } catch (Buffer.BufferException e) {
                throw new ConnectionException(e);
            }
        log.info("Remote end listening on {}", forward);
        listeners.put(forward, listener);
        return forward;
    }
View Full Code Here

        try {
            chan = new ForwardedTCPIPChannel(conn, buf.readUInt32AsInt(), buf.readUInt32(), buf.readUInt32(),
                                             new Forward(buf.readString(), buf.readUInt32AsInt()),
                                             buf.readString(), buf.readUInt32AsInt());
        } catch (Buffer.BufferException be) {
            throw new ConnectionException(be);
        }
        if (listeners.containsKey(chan.getParentForward()))
            callListener(listeners.get(chan.getParentForward()), chan);
        else
            chan.reject(OpenFailException.Reason.ADMINISTRATIVELY_PROHIBITED, "Forwarding was not requested on `"
View Full Code Here

TOP

Related Classes of net.schmizz.sshj.connection.ConnectionException

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.