1 /* 2 * Copyright 2006 Simon Raess 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package net.sf.beep4j; 17 18 import java.net.SocketAddress; 19 20 /** 21 * An interface whose implementations allow to initiate BEEP sessions. 22 * The connect methods connect to a remote peer identified by a 23 * SocketAddress. The SessionHandler receives callbacks for important 24 * moments in the lifecycle of the session. 25 * 26 * @author Simon Raess 27 */ 28 public interface Initiator extends Peer { 29 30 /** 31 * Tries to establish a session to the peer specified by the given 32 * address. The SessionHandler receives call backs as certain events 33 * in the session life cycle are reached. 34 * 35 * @param address the address of the peer 36 * @param handler the handler callback 37 */ 38 void connect(SocketAddress address, SessionHandler handler); 39 40 }