Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
    
  
  
  
  
    
    
    
  
  
    
    
    
    LayeredSocketFactory
    interface LayeredSocketFactory : SocketFactory
    
    
    
    
    A SocketFactory for layered sockets (SSL/TLS). See there for things to consider when implementing a socket factory.
    Summary
    
      
        
          | Public methods | 
        
          | abstract Socket! | Returns a socket connected to the given host that is layered over an existing socket. | 
      
    
    
      
        
          | Inherited functions | 
        
          | From class SocketFactory
                
                  
                    | Socket! | connectSocket(sock: Socket!, host: String!, port: Int, localAddress: InetAddress!, localPort: Int, params: HttpParams!)
                         Connects a socket to the given host. |  
                    | Socket! | createSocket()
                         Creates a new, unconnected socket. The socket should subsequently be passed to connectSocket. |  
                    | Boolean | isSecure(sock: Socket!)
                         Checks whether a socket provides a secure connection. The socket must be connectedby 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.
 |  | 
      
    
    Public methods
    
      createSocket
      
      abstract fun createSocket(
    socket: Socket!, 
    host: String!, 
    port: Int, 
    autoClose: Boolean
): Socket!
      Deprecated: Deprecated in Java. 
      Returns a socket connected to the given host that is layered over an existing socket. Used primarily for creating secure sockets through proxies.
      
        
          
            | Parameters | 
          
            | socket | Socket!: the existing socket | 
          
            | host | String!: the host name/IP | 
          
            | port | Int: the port on the host | 
          
            | autoClose | Boolean: a flag for closing the underling socket when the created socket is closed | 
        
      
      
        
          
            | Return | 
          
            | Socket! | Socket a new socket | 
        
      
      
        
          
            | Exceptions | 
          
            | java.io.IOException | if an I/O error occurs while creating the socket | 
          
            | java.net.UnknownHostException | if the IP address of the host cannot be determined | 
        
      
     
  
  
  
    
  
 
  
    
      
      
    
    
      
    
    
  
       
    
    
      
    
  
  
  Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
  Last updated 2025-02-10 UTC.
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[]]