package com.jscape.util.net.socket;

import com.jscape.util.io.DataCodec;
import com.jscape.util.net.connection.SyncMessageConnectionSyncRawBase;

import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.IOException;
import java.net.Socket;

/**
 * @author Alex Usun
 */
public class SocketSyncMessageConnection<M>
        extends SyncMessageConnectionSyncRawBase<M>
        implements SocketConnection {

    public SocketSyncMessageConnection(SocketRawConnection base, DataCodec<M> messageCodec) {
        super(base, messageCodec);
    }

    @Override
    public Socket socket() {
        return ((SocketRawConnection) base()).socket();
    }

    @Override
    public SSLSocket protect(SSLSocketFactory factory)
            throws IOException {
        return ((SocketRawConnection) base()).protect(factory);
    }

    @Override
    public void unprotect(boolean shutdown)
            throws IOException {
        ((SocketRawConnection) base()).unprotect(shutdown);
    }
}
