1/*
2 * Copyright (c) 2006-2011 Christian Plattner. All rights reserved.
3 * Please refer to the LICENSE.txt for licensing details.
4 */
5package ch.ethz.ssh2;
6
7/**
8 * A <code>ConnectionMonitor</code> is used to get notified when the
9 * underlying socket of a connection is closed.
10 *
11 * @author Christian Plattner
12 * @version 2.50, 03/15/10
13 */
14
15public interface ConnectionMonitor
16{
17	/**
18	 * This method is called after the connection's underlying
19	 * socket has been closed. E.g., due to the {@link Connection#close()} request of the
20	 * user, if the peer closed the connection, due to a fatal error during connect()
21	 * (also if the socket cannot be established) or if a fatal error occured on
22	 * an established connection.
23	 * <p>
24	 * This is an experimental feature.
25	 * <p>
26	 * You MUST NOT make any assumption about the thread that invokes this method.
27	 * <p>
28	 * <b>Please note: if the connection is not connected (e.g., there was no successful
29	 * connect() call), then the invocation of {@link Connection#close()} will NOT trigger
30	 * this method.</b>
31	 *
32	 * @see Connection#addConnectionMonitor(ConnectionMonitor)
33	 *
34	 * @param reason Includes an indication why the socket was closed.
35	 */
36	public void connectionLost(Throwable reason);
37}