if (v instanceof RuntimeException) {
throw (RuntimeException) v;
} else if (v instanceof Error) {
throw (Error) v;
} else if (v instanceof Throwable) {
throw (RuntimeSshException) new RuntimeSshException("Error reading from channel.").initCause((Throwable) v);
} else if (v instanceof Integer) {
return (Integer) v;
} else {
throw new IllegalStateException();
}