LrJposChannel.setSocketFactory

Sets the socket factory to be used by the channel.

public static void setSocketFactory(ISOClientSocketFactory socketFactory)

Parameters

  • socketFactory: The org.jpos.iso.ISOClientSocketFactory instance that represents the socket factory to be set for the channel.

Return values

This function does not return any values.

General information

The socket factory is used by the channel to create special sockets. It might also be used to provide hooks for SSL implementations.

Example

Copy code
public void socketFactoryTest() throws Throwable{

        GenericPackager packager = new GenericPackager(PACKAGERCONFIGFILE);
        LrJposChannel.initChannel(LrJposChannel.ChannelType.GZIPChannel, "localhost", 8000, packager);
        
        ISOClientSocketFactory socketFactory = new GenericSSLSocketFactory();
        LrJposChannel.setSocketFactory(socketFactory);
        
        ISOClientSocketFactory result = LrJposChannel.getSocketFactory();
        if (result == socketFactory) {
            lr.output_message("same instances");
        }
        else {
            lr.output_message("different instances");
        }
        
        LrJposChannel.closeChannel();
}