net.jini.jeri.http
Class HttpEndpoint.SocketFactoryAdapter

java.lang.Object
  extended by net.jini.jeri.http.HttpEndpoint.SocketFactoryAdapter
All Implemented Interfaces:
HttpClientSocketFactory
Enclosing class:
HttpEndpoint

private static final class HttpEndpoint.SocketFactoryAdapter
extends Object
implements HttpClientSocketFactory

SocketFactory -> HttpClientSocketFactory adapter.


Field Summary
private  Constraints.Distilled distilled
           
private  SocketFactory sf
           
 
Constructor Summary
HttpEndpoint.SocketFactoryAdapter(SocketFactory sf, Constraints.Distilled distilled)
           
 
Method Summary
private  Socket connectToHost(String host, int port, Constraints.Distilled distilled)
          Returns a socket connected to the specified host and port, according to the specified constraints.
private  Socket connectToSocketAddress(SocketAddress socketAddress, Constraints.Distilled distilled)
          Returns a socket connected to the specified address, with a timeout governed by the specified constraints.
 Socket createSocket(String host, int port)
          Creates client socket connected to the given host and port.
 Socket createTunnelSocket(Socket s)
          Creates layered socket on top of given base socket, for use when tunneling HTTP messages through a proxy.
private  Socket newSocket()
          Returns a new unconnected socket, using this endpoint's socket factory if non-null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sf

private final SocketFactory sf

distilled

private final Constraints.Distilled distilled
Constructor Detail

HttpEndpoint.SocketFactoryAdapter

HttpEndpoint.SocketFactoryAdapter(SocketFactory sf,
                                  Constraints.Distilled distilled)
Method Detail

createSocket

public Socket createSocket(String host,
                           int port)
                    throws IOException
Description copied from interface: HttpClientSocketFactory
Creates client socket connected to the given host and port.

Specified by:
createSocket in interface HttpClientSocketFactory
Throws:
IOException

connectToHost

private Socket connectToHost(String host,
                             int port,
                             Constraints.Distilled distilled)
                      throws IOException
Returns a socket connected to the specified host and port, according to the specified constraints. If the host name resolves to multiple addresses, attempts to connect to each of them in order until one succeeds.

Throws:
IOException

connectToSocketAddress

private Socket connectToSocketAddress(SocketAddress socketAddress,
                                      Constraints.Distilled distilled)
                               throws IOException
Returns a socket connected to the specified address, with a timeout governed by the specified constraints.

Throws:
IOException

newSocket

private Socket newSocket()
                  throws IOException
Returns a new unconnected socket, using this endpoint's socket factory if non-null.

Throws:
IOException

createTunnelSocket

public Socket createTunnelSocket(Socket s)
                          throws IOException
Description copied from interface: HttpClientSocketFactory
Creates layered socket on top of given base socket, for use when tunneling HTTP messages through a proxy.

Specified by:
createTunnelSocket in interface HttpClientSocketFactory
Throws:
IOException


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.