public SSLSocketChannelOutput(final SSLSocketChannel channel) { countingOut = new ByteCountingOutputStream(new SSLSocketChannelOutputStream(channel)); out = new BufferedOutputStream(countingOut); }
public SSLCommsSession(final SSLContext sslContext, final String hostname, final int port, final int timeoutMillis) throws IOException { final SocketChannel socketChannel = SocketChannel.open(); socketChannel.socket().connect(new InetSocketAddress(hostname, port), timeoutMillis); socketChannel.configureBlocking(false); sslSocketChannel = new SSLSocketChannel(sslContext, socketChannel,true); in = new SSLSocketChannelInputStream(sslSocketChannel); bufferedIn = new BufferedInputStream(in); out = new SSLSocketChannelOutputStream(sslSocketChannel); bufferedOut = new BufferedOutputStream(out); this.sslContext = sslContext; this.hostname = hostname; this.port = port; }
@Override public void open() throws IOException { if (sslChannel == null) { super.open(); sslChannel = new SSLSocketChannel(sslContext, channel, true); } sslChannel.setTimeout(timeout); // SSLSocketChannel will check if already connected so we can safely call this sslChannel.connect(); sslOutputStream = new SSLSocketChannelOutputStream(sslChannel); }
public SSLCommsSession(final SSLContext sslContext, final String hostname, final int port, final int timeoutMillis) throws IOException { final SocketChannel socketChannel = SocketChannel.open(); socketChannel.socket().connect(new InetSocketAddress(hostname, port), timeoutMillis); socketChannel.configureBlocking(false); sslSocketChannel = new SSLSocketChannel(sslContext, socketChannel,true); in = new SSLSocketChannelInputStream(sslSocketChannel); bufferedIn = new BufferedInputStream(in); out = new SSLSocketChannelOutputStream(sslSocketChannel); bufferedOut = new BufferedOutputStream(out); this.sslContext = sslContext; this.hostname = hostname; this.port = port; }