Package com.sshtools.j2ssh.transport

Examples of com.sshtools.j2ssh.transport.InvalidMessageException


        try {
            //baw.write(ok ? 1 : 0);
            baw.writeString(algorithm);
            baw.writeBinaryString(key);
        } catch (IOException ioe) {
            throw new InvalidMessageException("Failed to write message data!");
        }
    }
View Full Code Here


        try {
            //ok = ((bar.read() == 1) ? true : false);
            algorithm = bar.readString();
            key = bar.readBinaryString();
        } catch (IOException ioe) {
            throw new InvalidMessageException("Failed to read message data!");
        }
    }
View Full Code Here

                baw.writeBinaryString(channelData);
            } else {
                baw.writeInt(0);
            }
        } catch (IOException ioe) {
            throw new InvalidMessageException("Invalid message data");
        }
    }
View Full Code Here

            if (bar.available() > 0) {
                channelData = bar.readBinaryString();
            }
        } catch (IOException ioe) {
            throw new InvalidMessageException("Invalid message data");
        }
    }
View Full Code Here

            if (bar.available() > 0) {
                type = bar.read();
                constructMessage(bar);
            } else {
                throw new InvalidMessageException(
                    "Not enough message data to complete the message");
            }
        } catch (IOException ioe) {
            throw new InvalidMessageException(
                "The message data cannot be read!");
        }
    }
View Full Code Here

            baw.write(type);
            constructByteArray(baw);

            return baw.toByteArray();
        } catch (IOException ioe) {
            throw new InvalidMessageException(
                "The message data cannot be written!");
        }
    }
View Full Code Here

        throws InvalidMessageException {
        try {
            Class impl = (Class) registeredMessages.get(new Integer(msgdata[0]));

            if (impl == null) {
                throw new InvalidMessageException("The message with id " +
                    String.valueOf(msgdata[0]) + " is not implemented");
            }

            SubsystemMessage msg = (SubsystemMessage) impl.newInstance();
            msg.fromByteArray(msgdata);
            addMessage(msg);

            return;
        } catch (IllegalAccessException iae) {
        } catch (InstantiationException ie) {
        }

        throw new InvalidMessageException("Could not instantiate message class");
    }
View Full Code Here

    protected void constructByteArray(ByteArrayWriter baw)
        throws InvalidMessageException {
        try {
            baw.writeBigInteger(e);
        } catch (IOException ioe) {
            throw new InvalidMessageException("Error writing message data: " +
                ioe.getMessage());
        }
    }
View Full Code Here

    protected void constructMessage(ByteArrayReader bar)
        throws InvalidMessageException {
        try {
            e = bar.readBigInteger();
        } catch (IOException ioe) {
            throw new InvalidMessageException("Error reading message data: " +
                ioe.getMessage());
        }
    }
View Full Code Here

                msg.fromByteArray(msgdata);
                log.info("Received message " + msg.getMessageName());

                return msg;
            } else {
                throw new InvalidMessageException("Unrecognised message id " +
                    id.toString());
            }
        } catch (Exception ex) {
            throw new InvalidMessageException(ex.getMessage());
        }
    }
View Full Code Here

TOP

Related Classes of com.sshtools.j2ssh.transport.InvalidMessageException

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.