![JAR search and dependency download from the Maven repository](/logo.png)
org.spongycastle.jsse.provider.ProvSSLSocketBase Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bctls-jdk15on Show documentation
Show all versions of bctls-jdk15on Show documentation
Spongy Castle is a package-rename (org.bouncycastle.* to org.spongycastle.*) of Bouncy Castle
intended for the Android platform. Android unfortunately ships with a stripped-down version of
Bouncy Castle, which prevents easy upgrades - Spongy Castle overcomes this and provides a full,
up-to-date version of the Bouncy Castle cryptographic libs.
The newest version!
package org.spongycastle.jsse.provider;
import java.io.IOException;
import java.net.InetAddress;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.nio.channels.SocketChannel;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import javax.net.ssl.HandshakeCompletedListener;
import javax.net.ssl.SSLSocket;
import org.spongycastle.jsse.BCSSLSocket;
abstract class ProvSSLSocketBase
extends SSLSocket
implements BCSSLSocket
{
protected final Set listeners = Collections.synchronizedSet(
new HashSet());
protected ProvSSLSocketBase()
{
super();
}
protected ProvSSLSocketBase(InetAddress address, int port, InetAddress clientAddress, int clientPort)
throws IOException
{
super(address, port, clientAddress, clientPort);
}
protected ProvSSLSocketBase(InetAddress address, int port) throws IOException
{
super(address, port);
}
protected ProvSSLSocketBase(String host, int port, InetAddress clientAddress, int clientPort)
throws IOException, UnknownHostException
{
super(host, port, clientAddress, clientPort);
}
protected ProvSSLSocketBase(String host, int port) throws IOException, UnknownHostException
{
super(host, port);
}
@Override
public void addHandshakeCompletedListener(HandshakeCompletedListener listener)
{
if (listener == null)
{
throw new IllegalArgumentException("'listener' cannot be null");
}
listeners.add(new HandshakeCompletedListenerAdapter(listener));
}
@Override
public SocketChannel getChannel()
{
// return super.getChannel();
throw new UnsupportedOperationException();
}
@Override
public boolean getOOBInline() throws SocketException
{
return false;
}
@Override
public void removeHandshakeCompletedListener(HandshakeCompletedListener listener)
{
if (listener == null)
{
throw new IllegalArgumentException("'listener' cannot be null");
}
if (!listeners.remove(new HandshakeCompletedListenerAdapter(listener)))
{
throw new IllegalArgumentException("'listener' is not registered");
}
}
@Override
public void sendUrgentData(int data) throws IOException
{
throw new UnsupportedOperationException("Urgent data not supported in TLS");
}
@Override
public void setOOBInline(boolean on) throws SocketException
{
if (on)
{
throw new UnsupportedOperationException("Urgent data not supported in TLS");
}
}
@Override
public void shutdownInput() throws IOException
{
throw new UnsupportedOperationException("shutdownInput() not supported in TLS");
}
@Override
public void shutdownOutput() throws IOException
{
throw new UnsupportedOperationException("shutdownOutput() not supported in TLS");
}
// TODO[jsse] Proper toString for sockets
// @Override
// public String toString()
// {
// return super.toString();
// }
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy