1e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson/* 2e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * Copyright (C) 2010 The Android Open Source Project 3e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * 4e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * Licensed under the Apache License, Version 2.0 (the "License"); 5e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * you may not use this file except in compliance with the License. 6e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * You may obtain a copy of the License at 7e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * 8e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * http://www.apache.org/licenses/LICENSE-2.0 9e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * 10e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * Unless required by applicable law or agreed to in writing, software 11e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * distributed under the License is distributed on an "AS IS" BASIS, 12e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * See the License for the specific language governing permissions and 14e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * limitations under the License. 15e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson */ 16e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson 17e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilsonpackage tests.http; 18e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson 19e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson/** 20e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * What should be done with the incoming socket. 21e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson */ 22e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilsonpublic enum SocketPolicy { 23e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson 24e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson /** 25e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * Keep the socket open after the response. This is the default HTTP/1.1 26e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * behavior. 27e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson */ 28e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson KEEP_OPEN, 29e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson 30e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson /** 31e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * Close the socket after the response. This is the default HTTP/1.0 32e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * behavior. 33e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson */ 34e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson DISCONNECT_AT_END, 35e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson 36e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson /** 37c996149b500fc4825156106554457fe2394ae087Jesse Wilson * Wrap the socket with SSL at the completion of this request/response 38c996149b500fc4825156106554457fe2394ae087Jesse Wilson * pair. Used for CONNECT messages to tunnel SSL over an HTTP proxy. 39c996149b500fc4825156106554457fe2394ae087Jesse Wilson */ 40c996149b500fc4825156106554457fe2394ae087Jesse Wilson UPGRADE_TO_SSL_AT_END, 41c996149b500fc4825156106554457fe2394ae087Jesse Wilson 42c996149b500fc4825156106554457fe2394ae087Jesse Wilson /** 43e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * Request immediate close of connection without even reading the 44e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * request. 45e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * 46e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * <p>Use to simulate the real life case of losing connection 47e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * because of bugger SSL server close connection when it seems 48e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * something like a compression method or TLS extension it doesn't 49e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * understand, instead of simply ignoring it like it should. 50e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson */ 51e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson DISCONNECT_AT_START, 52e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson 53e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson /** 54e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * Shutdown the socket input after sending the response. For testing bad 55e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * behavior. 56e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson */ 57e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson SHUTDOWN_INPUT_AT_END, 58e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson 59e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson /** 60e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * Shutdown the socket output after sending the response. For testing bad 61e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson * behavior. 62e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson */ 63e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson SHUTDOWN_OUTPUT_AT_END 64e942f46f10bb9384a1b186b3d7b74f9704c57090Jesse Wilson} 65