Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2012 Yannick Roffin Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 package org.jbehaviour.plugins.remote.impl;
 import java.util.List;
 import  com.sshtools.j2ssh.SshClient;
 import  com.sshtools.j2ssh.authentication.AuthenticationProtocolState;
 import  com.sshtools.j2ssh.authentication.PasswordAuthenticationClient;
 import  com.sshtools.j2ssh.transport.AbstractKnownHostsKeyVerification;
 import  com.sshtools.j2ssh.transport.TransportProtocolException;
 import  com.sshtools.j2ssh.transport.publickey.SshPublicKey;
 public abstract class SslFileSystemResource extends FileSystemResourceImpl {
 	public boolean checkIfFileExist(String filenamethrows IOException {
 		..println("Using abstract method checkIfFileExist !!!");
 		return false;
 	public List<ResourcesItemlistdir(String directorythrows IOException {
 		..println("Using abstract method listdir !!!");
 		return res;
 	public List<Stringexecute(String commandthrows IOException {
 		..println("Using abstract method !!!");
 		List<Stringres = new ArrayList<String>();
 		return res;
 	public void close() throws IOException {
 	private class LocalKnownHostsKeyVerification extends
 			AbstractKnownHostsKeyVerification {
 		public boolean verifyHost(String arg0, SshPublicKey arg1)
 				throws TransportProtocolException {
 			return true;
 		public LocalKnownHostsKeyVerification(File tempFilethrows IOException {
 		public void onHostKeyMismatch(String arg0, SshPublicKey arg1,
 				SshPublicKey arg2throws TransportProtocolException {
 		public void onUnknownHost(String arg0, SshPublicKey arg1)
 				throws TransportProtocolException {
 	SshClient ssh = new SshClient();
 	public void open() throws IOException {
 		if (.isConnected()) return;

SSL connect layer
		if (!.isConnected()) {
			throw new IOException("Unable to connect to " + );
		PasswordAuthenticationClient pwd = new PasswordAuthenticationClient();
		int result = .authenticate(pwd);
		if (result == AuthenticationProtocolState.FAILED) {
			throw new IOException("The authentication failed");
		if (result == AuthenticationProtocolState.PARTIAL) {
			throw new IOException("The authentication succeeded but another"
"authentication is required");
		if (result == AuthenticationProtocolState.COMPLETE) {
			..println("The authentication is complete");
New to GrepCode? Check out our FAQ X