コード例 #1
0
ファイル: PacketReaderTest.java プロジェクト: majinding/sshj
  @Test
  public void shouldFailWhenPacketLengthTooLarge() throws Exception {
    dataout.writeInt(Integer.MAX_VALUE);
    dataout.flush();

    try {
      reader.readPacket();
      fail("Should have failed to read packet of size " + Integer.MAX_VALUE);
    } catch (SSHException e) {
      e.printStackTrace();
      // success; indicated packet size was too large
    }
  }
コード例 #2
0
ファイル: TransportImpl.java プロジェクト: majinding/sshj
  public void die(Exception ex) {
    close.lock();
    try {
      if (!close.isSet()) {

        log.error("Dying because - {}", ex);

        final SSHException causeOfDeath = SSHException.chainer.chain(ex);

        disconnectListener.notifyDisconnect(
            causeOfDeath.getDisconnectReason(), causeOfDeath.getMessage());

        ErrorDeliveryUtil.alertEvents(causeOfDeath, close, serviceAccept);
        kexer.notifyError(causeOfDeath);
        getService().notifyError(causeOfDeath);
        setService(nullService);

        { // Perhaps can send disconnect packet to server
          final boolean didNotReceiveDisconnect = msg != Message.DISCONNECT;
          final boolean gotRequiredInfo =
              causeOfDeath.getDisconnectReason() != DisconnectReason.UNKNOWN;
          if (didNotReceiveDisconnect && gotRequiredInfo)
            sendDisconnect(causeOfDeath.getDisconnectReason(), causeOfDeath.getMessage());
        }

        finishOff();

        close.set();
      }
    } finally {
      close.unlock();
    }
  }
コード例 #3
0
ファイル: AbstractService.java プロジェクト: shashesh/ACWAVAB
 @Override
 public void notifyError(SSHException error) {
   log.debug("Notified of {}", error.toString());
 }