package com.jscape.util.net.socket;

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

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

/**
 * @author Alex Usun
 */
public class SocketAsyncMessageConnection<M>
        extends AsyncMessageConnectionSyncRawBase<M>
        implements SocketConnection {

    public SocketAsyncMessageConnection(SocketRawConnection base, DataCodec<M> messageCodec, ExecutorService executorService) {
        super(base, messageCodec, executorService);
    }

    @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);
    }
}
