1
15
16 package software.amazon.awssdk.http.apache.internal.net;
17
18 import java.io.IOException;
19 import java.net.SocketAddress;
20 import javax.net.ssl.SSLSocket;
21 import software.amazon.awssdk.annotations.SdkInternalApi;
22 import software.amazon.awssdk.utils.Logger;
23
24 @SdkInternalApi
25 public class SdkSslSocket extends DelegateSslSocket {
26 private static final Logger log = Logger.loggerFor(SdkSslSocket.class);
27
28 public SdkSslSocket(SSLSocket sock) {
29 super(sock);
30 log.debug(() -> "created: " + endpoint());
31 }
32
33
36 private String endpoint() {
37 return sock.getInetAddress() + ":" + sock.getPort();
38 }
39
40 @Override
41 public void connect(SocketAddress endpoint) throws IOException {
42 log.trace(() -> "connecting to: " + endpoint);
43 sock.connect(endpoint);
44 log.debug(() -> "connected to: " + endpoint);
45 }
46
47 @Override
48 public void connect(SocketAddress endpoint, int timeout) throws IOException {
49 log.trace(() -> "connecting to: " + endpoint);
50 sock.connect(endpoint, timeout);
51 log.debug(() -> "connected to: " + endpoint);
52 }
53
54 @Override
55 public void close() throws IOException {
56 log.debug(() -> "closing " + endpoint());
57 sock.close();
58 }
59
60 @Override
61 public void shutdownInput() throws IOException {
62 log.debug(() -> "shutting down input of " + endpoint());
63 sock.shutdownInput();
64 }
65
66 @Override
67 public void shutdownOutput() throws IOException {
68 log.debug(() -> "shutting down output of " + endpoint());
69 sock.shutdownOutput();
70 }
71 }
72