1/*
2 * Copyright (C) 2010 The Android Open Source Project
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
17package tests.http;
18
19/**
20 * What should be done with the incoming socket.
21 */
22public enum SocketPolicy {
23
24    /**
25     * Keep the socket open after the response. This is the default HTTP/1.1
26     * behavior.
27     */
28    KEEP_OPEN,
29
30    /**
31     * Close the socket after the response. This is the default HTTP/1.0
32     * behavior.
33     */
34    DISCONNECT_AT_END,
35
36    /**
37     * Wrap the socket with SSL at the completion of this request/response
38     * pair. Used for CONNECT messages to tunnel SSL over an HTTP proxy.
39     */
40    UPGRADE_TO_SSL_AT_END,
41
42    /**
43     * Request immediate close of connection without even reading the
44     * request.
45     *
46     * <p>Use to simulate the real life case of losing connection
47     * because of bugger SSL server close connection when it seems
48     * something like a compression method or TLS extension it doesn't
49     * understand, instead of simply ignoring it like it should.
50     */
51    DISCONNECT_AT_START,
52
53    /**
54     * Shutdown the socket input after sending the response. For testing bad
55     * behavior.
56     */
57    SHUTDOWN_INPUT_AT_END,
58
59    /**
60     * Shutdown the socket output after sending the response. For testing bad
61     * behavior.
62     */
63    SHUTDOWN_OUTPUT_AT_END
64}
65