Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2011, 2012 SAP AG All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at Contributors: Lazar Kirchev, SAP AG - initial API and implementation /
package org.eclipse.equinox.console.commands;
This class implements functionality to disconnect from telnet or ssh console.
public class DisconnectCommand {
	private static final String CLOSEABLE = "CLOSEABLE";
	private static final String DISCONNECT_MESSAGE = "Disconnect from console? (y/n; default=y) ";
	private static final String DISCONNECT_CONFIRMATION_Y = "y";
	public DisconnectCommand(BundleContext context) {
		this. = context;
	public void startService() {
		Dictionary<StringObjectprops = new Hashtable<StringObject>();
		props.put(.new String[] {"disconnect"});
	public void disconnect(CommandSession session) {
		String reply = null;
		try {
			reply = reader.readLine();
catch (IOException e) {
			..println("Error while reading confirmation");
		if (reply != null) {
			if (reply.toLowerCase().startsWith() || reply.length() == 0) {
				Closeable closable = (Closeable)session.get();
				if (closable != null) {
					try {
catch (IOException e) {
New to GrepCode? Check out our FAQ X