The factory encapsulates the logic for establishing a socket connection.
Both java.lang.Object.equals(java.lang.Object) and java.lang.Object.hashCode() must be overridden for the correct operation of some connection managers.
- Author
- Roland Weber
-
Michael Becke
-
Mike Bowler
Notice
The following notice applies to the original API on which this API is based, and to its documentation. The documentation of this API has been revised from the original.
/*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
boolean isSecure |
( |
Socket |
sock | ) |
throws IllegalArgumentException |
The socket must be connected by this factory. The factory will not perform I/O operations in this method.
As a rule of thumb, plain sockets are not secure and TLS/SSL sockets are secure. However, there may be application specific deviations. For example, a plain socket to a host in the same intranet ("trusted zone") could be considered secure. On the other hand, a TLS/SSL socket could be considered insecure based on the cypher suite chosen for the connection.
- Parameters
-
sock | the connected socket to check |
- Returns
true
if the connection of the socket should be considered secure, or false
if it should not
- Exceptions
-
IllegalArgumentException | if the argument is invalid, for example because it is not a connected socket or was created by a different socket factory. Note that socket factories are not required to check these conditions, they may simply return a default value when called with an invalid socket argument. |
Implemented in SSLSocketFactory, MultihomePlainSocketFactory, and PlainSocketFactory.