View Javadoc
1   /*
2    * #%L
3    * SocketConnectionListener.java - mongodb-async-driver - Allanbank Consulting, Inc.
4    * %%
5    * Copyright (C) 2011 - 2014 Allanbank Consulting, Inc.
6    * %%
7    * Licensed under the Apache License, Version 2.0 (the "License");
8    * you may not use this file except in compliance with the License.
9    * You may obtain a copy of the License at
10   * 
11   *      http://www.apache.org/licenses/LICENSE-2.0
12   * 
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   * #L%
19   */
20  
21  package com.allanbank.mongodb.client.connection;
22  
23  import java.net.InetSocketAddress;
24  import java.net.Socket;
25  import java.net.SocketException;
26  
27  import javax.net.SocketFactory;
28  
29  /**
30   * SocketConnectionListener provides a callback interface for
31   * {@link SocketFactory} instances to implement that wish to be notified of
32   * connection completion. This will mainly be for security issues.
33   * 
34   * @api.no This interface is <b>NOT</b> part of the drivers API. This class may
35   *         be mutated in incompatible ways between any two releases of the
36   *         driver.
37   * @copyright 2013, Allanbank Consulting, Inc., All Rights Reserved
38   */
39  public interface SocketConnectionListener {
40  
41      /**
42       * Notification that the socket is now connected to the specified
43       * InetSocketAddress.
44       * 
45       * @param connectedTo
46       *            The address the socket has been connected to.
47       * @param connection
48       *            The socket connection.
49       * @throws SocketException
50       *             On a failure configuring the socket.
51       */
52      public void connected(InetSocketAddress connectedTo, Socket connection)
53              throws SocketException;
54  }