@Test public void testSetConfiguration() throws Throwable { BaseChannel gZIPChannel = new GZIPChannel(new ISO93BPackager(), null); gZIPChannel.setSocketFactory(new GenericSSLSocketFactory()); gZIPChannel.setConfiguration(new SimpleConfiguration()); assertEquals(300000, gZIPChannel.getTimeout(), "(GZIPChannel) gZIPChannel.getTimeout()"); assertEquals(100000, gZIPChannel.getMaxPacketLength(), "(GZIPChannel) gZIPChannel.getMaxPacketLength()"); assertFalse(((GZIPChannel) gZIPChannel).overrideHeader, "(GZIPChannel) gZIPChannel.overrideHeader"); }
public void setConfiguration (Configuration cfg) throws ConfigurationException { this.cfg = cfg; String h = cfg.get ("host"); int port = cfg.getInt ("port"); maxPacketLength = cfg.getInt ("max-packet-length", 100000); if (h != null && h.length() > 0) { if (port == 0) throw new ConfigurationException ("invalid port for host '"+h+"'"); setHost (h, port); setLocalAddress (cfg.get("local-iface", null),cfg.getInt("local-port")); String[] altHosts = cfg.getAll ("alternate-host"); int[] altPorts = cfg.getInts ("alternate-port"); hosts = new String[altHosts.length + 1]; ports = new int[altPorts.length + 1]; if (hosts.length != ports.length) { throw new ConfigurationException ( "alternate host/port misconfiguration" ); } hosts[0] = host; ports[0] = port; System.arraycopy (altHosts, 0, hosts, 1, altHosts.length); System.arraycopy (altPorts, 0, ports, 1, altPorts.length); } setOverrideHeader(cfg.getBoolean ("override-header", false)); keepAlive = cfg.getBoolean ("keep-alive", false); expectKeepAlive = cfg.getBoolean ("expect-keep-alive", false); roundRobin = cfg.getBoolean ("round-robin", false); if (socketFactory != this && socketFactory instanceof Configurable) ((Configurable)socketFactory).setConfiguration (cfg); try { setTimeout (cfg.getInt ("timeout", DEFAULT_TIMEOUT)); connectTimeout = cfg.getInt ("connect-timeout", timeout); } catch (SocketException e) { throw new ConfigurationException (e); } }
BaseChannel extends Observable implements FilteredChannel, ClientChannel, ServerChannel, FactoryChannel, 
               LogSource, Configurable, BaseChannelMBean, Cloneable, ExceptionHandlerAware { public void setConfiguration (Configuration cfg) throws ConfigurationException { this.cfg = cfg; String h = cfg.get ("host"); int port = cfg.getInt ("port"); maxPacketLength = cfg.getInt ("max-packet-length", 100000); if (h != null && h.length() > 0) { if (port == 0) throw new ConfigurationException ("invalid port for host '"+h+"'"); setHost (h, port); setLocalAddress (cfg.get("local-iface", null),cfg.getInt("local-port")); String[] altHosts = cfg.getAll ("alternate-host"); int[] altPorts = cfg.getInts ("alternate-port"); hosts = new String[altHosts.length + 1]; ports = new int[altPorts.length + 1]; if (hosts.length != ports.length) { throw new ConfigurationException ( "alternate host/port misconfiguration" ); } hosts[0] = host; ports[0] = port; System.arraycopy (altHosts, 0, hosts, 1, altHosts.length); System.arraycopy (altPorts, 0, ports, 1, altPorts.length); } setOverrideHeader(cfg.getBoolean ("override-header", false)); keepAlive = cfg.getBoolean ("keep-alive", false); expectKeepAlive = cfg.getBoolean ("expect-keep-alive", false); roundRobin = cfg.getBoolean ("round-robin", false); if (socketFactory != this && socketFactory instanceof Configurable) ((Configurable)socketFactory).setConfiguration (cfg); try { setTimeout (cfg.getInt ("timeout", DEFAULT_TIMEOUT)); connectTimeout = cfg.getInt ("connect-timeout", timeout); } catch (SocketException e) { throw new ConfigurationException (e); } } }
BaseChannel extends Observable implements FilteredChannel, ClientChannel, ServerChannel, FactoryChannel, 
               LogSource, Configurable, BaseChannelMBean, Cloneable, ExceptionHandlerAware { public void setConfiguration (Configuration cfg) throws ConfigurationException { this.cfg = cfg; String h = cfg.get ("host"); int port = cfg.getInt ("port"); maxPacketLength = cfg.getInt ("max-packet-length", 100000); if (h != null && h.length() > 0) { if (port == 0) throw new ConfigurationException ("invalid port for host '"+h+"'"); setHost (h, port); setLocalAddress (cfg.get("local-iface", null),cfg.getInt("local-port")); String[] altHosts = cfg.getAll ("alternate-host"); int[] altPorts = cfg.getInts ("alternate-port"); hosts = new String[altHosts.length + 1]; ports = new int[altPorts.length + 1]; if (hosts.length != ports.length) { throw new ConfigurationException ( "alternate host/port misconfiguration" ); } hosts[0] = host; ports[0] = port; System.arraycopy (altHosts, 0, hosts, 1, altHosts.length); System.arraycopy (altPorts, 0, ports, 1, altPorts.length); } setOverrideHeader(cfg.getBoolean ("override-header", false)); keepAlive = cfg.getBoolean ("keep-alive", false); expectKeepAlive = cfg.getBoolean ("expect-keep-alive", false); roundRobin = cfg.getBoolean ("round-robin", false); if (socketFactory != this && socketFactory instanceof Configurable) ((Configurable)socketFactory).setConfiguration (cfg); try { setTimeout (cfg.getInt ("timeout", DEFAULT_TIMEOUT)); connectTimeout = cfg.getInt ("connect-timeout", timeout); } catch (SocketException e) { throw new ConfigurationException (e); } } BaseChannel();  BaseChannel(String host, int port, ISOPackager p);  BaseChannel(ISOPackager p);  BaseChannel(ISOPackager p, ServerSocket serverSocket); }
BaseChannel extends Observable implements FilteredChannel, ClientChannel, ServerChannel, FactoryChannel, 
               LogSource, Configurable, BaseChannelMBean, Cloneable, ExceptionHandlerAware { public void setConfiguration (Configuration cfg) throws ConfigurationException { this.cfg = cfg; String h = cfg.get ("host"); int port = cfg.getInt ("port"); maxPacketLength = cfg.getInt ("max-packet-length", 100000); if (h != null && h.length() > 0) { if (port == 0) throw new ConfigurationException ("invalid port for host '"+h+"'"); setHost (h, port); setLocalAddress (cfg.get("local-iface", null),cfg.getInt("local-port")); String[] altHosts = cfg.getAll ("alternate-host"); int[] altPorts = cfg.getInts ("alternate-port"); hosts = new String[altHosts.length + 1]; ports = new int[altPorts.length + 1]; if (hosts.length != ports.length) { throw new ConfigurationException ( "alternate host/port misconfiguration" ); } hosts[0] = host; ports[0] = port; System.arraycopy (altHosts, 0, hosts, 1, altHosts.length); System.arraycopy (altPorts, 0, ports, 1, altPorts.length); } setOverrideHeader(cfg.getBoolean ("override-header", false)); keepAlive = cfg.getBoolean ("keep-alive", false); expectKeepAlive = cfg.getBoolean ("expect-keep-alive", false); roundRobin = cfg.getBoolean ("round-robin", false); if (socketFactory != this && socketFactory instanceof Configurable) ((Configurable)socketFactory).setConfiguration (cfg); try { setTimeout (cfg.getInt ("timeout", DEFAULT_TIMEOUT)); connectTimeout = cfg.getInt ("connect-timeout", timeout); } catch (SocketException e) { throw new ConfigurationException (e); } } BaseChannel();  BaseChannel(String host, int port, ISOPackager p);  BaseChannel(ISOPackager p);  BaseChannel(ISOPackager p, ServerSocket serverSocket); void setHost(String host, int port); void setLocalAddress(String iface, int port); void setHost(String host); void setPort(int port); String getHost(); int getPort(); void setPackager(ISOPackager p); ISOPackager getPackager(); void setServerSocket(ServerSocket sock); @Override Map<Class<? extends Exception>, List<ExceptionHandler>> getExceptionHandlers(); void resetCounters(); int[] getCounters(); boolean isConnected(); Socket getSocket(); ServerSocket getServerSocket(); void setTimeout(int timeout); int getTimeout(); void setSoLinger(boolean on, int linger); boolean isSoLingerOn(); int getSoLingerSeconds(); void connect(); void accept(ServerSocket s); void setUsable(boolean b); void send(ISOMsg m); void send(byte[] b); void sendKeepAlive(); ISOMsg receive(); int getBytes(byte[] b); void disconnect(); void reconnect(); void setLogger(Logger logger, String realm); String getRealm(); Logger getLogger(); String getOriginalRealm(); void setName(String name); String getName(); @SuppressWarnings ("unchecked") void addFilter(ISOFilter filter, int direction); void addIncomingFilter(ISOFilter filter); void addOutgoingFilter(ISOFilter filter); void addFilter(ISOFilter filter); void removeFilter(ISOFilter filter, int direction); void removeFilter(ISOFilter filter); void removeIncomingFilter(ISOFilter filter); void removeOutgoingFilter(ISOFilter filter); void setConfiguration(Configuration cfg); Configuration getConfiguration(); Collection<ISOFilter> getIncomingFilters(); Collection<ISOFilter> getOutgoingFilters(); void setIncomingFilters(Collection filters); void setOutgoingFilters(Collection filters); void setHeader(byte[] header); void setHeader(String header); byte[] getHeader(); void setOverrideHeader(boolean overrideHeader); boolean isOverrideHeader(); static ISOChannel getChannel(String name); ISOClientSocketFactory getSocketFactory(); void setSocketFactory(ISOClientSocketFactory socketFactory); int getMaxPacketLength(); void setMaxPacketLength(int maxPacketLength); Object clone(); }
BaseChannel extends Observable implements FilteredChannel, ClientChannel, ServerChannel, FactoryChannel, 
               LogSource, Configurable, BaseChannelMBean, Cloneable, ExceptionHandlerAware { public void setConfiguration (Configuration cfg) throws ConfigurationException { this.cfg = cfg; String h = cfg.get ("host"); int port = cfg.getInt ("port"); maxPacketLength = cfg.getInt ("max-packet-length", 100000); if (h != null && h.length() > 0) { if (port == 0) throw new ConfigurationException ("invalid port for host '"+h+"'"); setHost (h, port); setLocalAddress (cfg.get("local-iface", null),cfg.getInt("local-port")); String[] altHosts = cfg.getAll ("alternate-host"); int[] altPorts = cfg.getInts ("alternate-port"); hosts = new String[altHosts.length + 1]; ports = new int[altPorts.length + 1]; if (hosts.length != ports.length) { throw new ConfigurationException ( "alternate host/port misconfiguration" ); } hosts[0] = host; ports[0] = port; System.arraycopy (altHosts, 0, hosts, 1, altHosts.length); System.arraycopy (altPorts, 0, ports, 1, altPorts.length); } setOverrideHeader(cfg.getBoolean ("override-header", false)); keepAlive = cfg.getBoolean ("keep-alive", false); expectKeepAlive = cfg.getBoolean ("expect-keep-alive", false); roundRobin = cfg.getBoolean ("round-robin", false); if (socketFactory != this && socketFactory instanceof Configurable) ((Configurable)socketFactory).setConfiguration (cfg); try { setTimeout (cfg.getInt ("timeout", DEFAULT_TIMEOUT)); connectTimeout = cfg.getInt ("connect-timeout", timeout); } catch (SocketException e) { throw new ConfigurationException (e); } } BaseChannel();  BaseChannel(String host, int port, ISOPackager p);  BaseChannel(ISOPackager p);  BaseChannel(ISOPackager p, ServerSocket serverSocket); void setHost(String host, int port); void setLocalAddress(String iface, int port); void setHost(String host); void setPort(int port); String getHost(); int getPort(); void setPackager(ISOPackager p); ISOPackager getPackager(); void setServerSocket(ServerSocket sock); @Override Map<Class<? extends Exception>, List<ExceptionHandler>> getExceptionHandlers(); void resetCounters(); int[] getCounters(); boolean isConnected(); Socket getSocket(); ServerSocket getServerSocket(); void setTimeout(int timeout); int getTimeout(); void setSoLinger(boolean on, int linger); boolean isSoLingerOn(); int getSoLingerSeconds(); void connect(); void accept(ServerSocket s); void setUsable(boolean b); void send(ISOMsg m); void send(byte[] b); void sendKeepAlive(); ISOMsg receive(); int getBytes(byte[] b); void disconnect(); void reconnect(); void setLogger(Logger logger, String realm); String getRealm(); Logger getLogger(); String getOriginalRealm(); void setName(String name); String getName(); @SuppressWarnings ("unchecked") void addFilter(ISOFilter filter, int direction); void addIncomingFilter(ISOFilter filter); void addOutgoingFilter(ISOFilter filter); void addFilter(ISOFilter filter); void removeFilter(ISOFilter filter, int direction); void removeFilter(ISOFilter filter); void removeIncomingFilter(ISOFilter filter); void removeOutgoingFilter(ISOFilter filter); void setConfiguration(Configuration cfg); Configuration getConfiguration(); Collection<ISOFilter> getIncomingFilters(); Collection<ISOFilter> getOutgoingFilters(); void setIncomingFilters(Collection filters); void setOutgoingFilters(Collection filters); void setHeader(byte[] header); void setHeader(String header); byte[] getHeader(); void setOverrideHeader(boolean overrideHeader); boolean isOverrideHeader(); static ISOChannel getChannel(String name); ISOClientSocketFactory getSocketFactory(); void setSocketFactory(ISOClientSocketFactory socketFactory); int getMaxPacketLength(); void setMaxPacketLength(int maxPacketLength); Object clone();  }