1
15 package com.amazonaws.internal;
16
17 import java.io.IOException;
18 import java.net.SocketAddress;
19
20 import javax.net.ssl.SSLSocket;
21
22 import org.apache.commons.logging.Log;
23 import org.apache.commons.logging.LogFactory;
24
25 public class SdkSSLSocket extends DelegateSSLSocket {
26 private static final Log log = LogFactory.getLog(SdkSSLSocket.class);
27
28 public SdkSSLSocket(SSLSocket sock) {
29 super(sock);
30 if (log.isDebugEnabled())
31 log.debug("created: " + endpoint());
32 }
33
34
37 private String endpoint() {
38 return sock.getInetAddress() + ":" + sock.getPort();
39 }
40
41 @Override
42 public void connect(SocketAddress endpoint) throws IOException {
43 if (log.isDebugEnabled())
44 log.debug("connecting to: " + endpoint);
45 sock.connect(endpoint);
46 if (log.isDebugEnabled())
47 log.debug("connected to: " + endpoint());
48 }
49
50 @Override
51 public void connect(SocketAddress endpoint, int timeout) throws IOException {
52 if (log.isDebugEnabled())
53 log.debug("connecting to: " + endpoint);
54 sock.connect(endpoint, timeout);
55 if (log.isDebugEnabled())
56 log.debug("connected to: " + endpoint());
57 }
58
59 @Override
60 public void close() throws IOException {
61 if (log.isDebugEnabled())
62 log.debug("closing " + endpoint());
63 sock.close();
64 }
65
66 @Override
67 public void shutdownInput() throws IOException {
68 if (log.isDebugEnabled())
69 log.debug("shutting down input of " + endpoint());
70 sock.shutdownInput();
71 }
72
73 @Override
74 public void shutdownOutput() throws IOException {
75 if (log.isDebugEnabled())
76 log.debug("shutting down output of " + endpoint());
77 sock.shutdownOutput();
78 }
79 }
80