View Javadoc
1   /*
2    * ====================================================================
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  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,
14   * software distributed under the License is distributed on an
15   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   * KIND, either express or implied.  See the License for the
17   * specific language governing permissions and limitations
18   * under the License.
19   * ====================================================================
20   *
21   * This software consists of voluntary contributions made by many
22   * individuals on behalf of the Apache Software Foundation.  For more
23   * information on the Apache Software Foundation, please see
24   * <http://www.apache.org/>.
25   *
26   */
27  
28  package org.apache.http.conn;
29  
30  import java.io.IOException;
31  import java.net.InetAddress;
32  
33  import org.apache.http.HttpHost;
34  import org.apache.http.params.HttpParams;
35  import org.apache.http.protocol.HttpContext;
36  
37  /**
38   * ClientConnectionOperator represents a strategy for creating
39   * {@link OperatedClientConnection} instances and updating the underlying
40   * {@link java.net.Socket} of those objects. Implementations will most
41   * likely make use of {@link org.apache.http.conn.scheme.SchemeSocketFactory}s
42   * to create {@link java.net.Socket} instances.
43   * <p>
44   * The methods in this interface allow the creation of plain and layered
45   * sockets. Creating a tunnelled connection through a proxy, however,
46   * is not within the scope of the operator.
47   * <p>
48   * Implementations of this interface must be thread-safe. Access to shared
49   * data must be synchronized as methods of this interface may be executed
50   * from multiple threads.
51   *
52   * @since 4.0
53   *
54   * @deprecated (4.3) replaced by {@link HttpClientConnectionManager}.
55   */
56  @Deprecated
57  public interface ClientConnectionOperator {
58  
59      /**
60       * Creates a new connection that can be operated.
61       *
62       * @return  a new, unopened connection for use with this operator
63       */
64      OperatedClientConnection createConnection();
65  
66      /**
67       * Opens a connection to the given target host.
68       *
69       * @param conn      the connection to open
70       * @param target    the target host to connect to
71       * @param local     the local address to route from, or
72       *                  {@code null} for the default
73       * @param context   the context for the connection
74       * @param params    the parameters for the connection
75       *
76       * @throws IOException      in case of a problem
77       */
78      void openConnection(OperatedClientConnection conn,
79                          HttpHost target,
80                          InetAddress local,
81                          HttpContext context,
82                          HttpParams params)
83          throws IOException;
84  
85      /**
86       * Updates a connection with a layered secure connection.
87       * The typical use of this method is to update a tunnelled plain
88       * connection (HTTP) to a secure TLS/SSL connection (HTTPS).
89       *
90       * @param conn      the open connection to update
91       * @param target    the target host for the updated connection.
92       *                  The connection must already be open or tunnelled
93       *                  to the host and port, but the scheme of the target
94       *                  will be used to create a layered connection.
95       * @param context   the context for the connection
96       * @param params    the parameters for the updated connection
97       *
98       * @throws IOException      in case of a problem
99       */
100     void updateSecureConnection(OperatedClientConnection conn,
101                                 HttpHost target,
102                                 HttpContext context,
103                                 HttpParams params)
104         throws IOException;
105 
106 }
107