Wed, 31 Dec 2014 07:22:50 +0100
Correct previous dual key logic pending first delivery installment.
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 */
28 package ch.boye.httpclientandroidlib.conn;
30 import java.io.IOException;
31 import java.net.InetAddress;
32 import java.net.Socket;
34 import ch.boye.httpclientandroidlib.HttpHost;
35 import ch.boye.httpclientandroidlib.conn.scheme.SchemeSocketFactory;
36 import ch.boye.httpclientandroidlib.params.HttpParams;
37 import ch.boye.httpclientandroidlib.protocol.HttpContext;
39 /**
40 * ClientConnectionOperator represents a strategy for creating
41 * {@link OperatedClientConnection} instances and updating the underlying
42 * {@link Socket} of those objects. Implementations will most likely make use
43 * of {@link SchemeSocketFactory}s to create {@link Socket} instances.
44 * <p>
45 * The methods in this interface allow the creation of plain and layered
46 * sockets. Creating a tunnelled connection through a proxy, however,
47 * is not within the scope of the operator.
48 * <p>
49 * Implementations of this interface must be thread-safe. Access to shared
50 * data must be synchronized as methods of this interface may be executed
51 * from multiple threads.
52 *
53 * @since 4.0
54 */
55 public interface ClientConnectionOperator {
57 /**
58 * Creates a new connection that can be operated.
59 *
60 * @return a new, unopened connection for use with this operator
61 */
62 OperatedClientConnection createConnection();
64 /**
65 * Opens a connection to the given target host.
66 *
67 * @param conn the connection to open
68 * @param target the target host to connect to
69 * @param local the local address to route from, or
70 * <code>null</code> for the default
71 * @param context the context for the connection
72 * @param params the parameters for the connection
73 *
74 * @throws IOException in case of a problem
75 */
76 void openConnection(OperatedClientConnection conn,
77 HttpHost target,
78 InetAddress local,
79 HttpContext context,
80 HttpParams params)
81 throws IOException;
83 /**
84 * Updates a connection with a layered secure connection.
85 * The typical use of this method is to update a tunnelled plain
86 * connection (HTTP) to a secure TLS/SSL connection (HTTPS).
87 *
88 * @param conn the open connection to update
89 * @param target the target host for the updated connection.
90 * The connection must already be open or tunnelled
91 * to the host and port, but the scheme of the target
92 * will be used to create a layered connection.
93 * @param context the context for the connection
94 * @param params the parameters for the updated connection
95 *
96 * @throws IOException in case of a problem
97 */
98 void updateSecureConnection(OperatedClientConnection conn,
99 HttpHost target,
100 HttpContext context,
101 HttpParams params)
102 throws IOException;
104 }