SocketResourceAdapter implements ResourceAdapter, SocketResourceAdapterConfiguration { public void endpointActivation(MessageEndpointFactory messageEndpointFactory, ActivationSpec activationSpec) throws ResourceException { logger.info("endpointActivation"); if (!(activationSpec instanceof SocketActivationSpec)) { throw new NotSupportedException("Invalid spec, Should be a " + SocketActivationSpec.class.getName() + " was: " + activationSpec); } SocketActivationSpec socketActivationSpec = (SocketActivationSpec) activationSpec; createSocketActivationSpec(socketActivationSpec); SocketListener socketListener = new SocketListener(workManager, socketActivationSpec, messageEndpointFactory); addToKnownListeners(socketActivationSpec, socketListener); try { socketListener.start(); } catch (ResourceException e) { socketListener.release(); throw e; } } SocketResourceAdapter(); String getDefaultIpAddress(); void start(BootstrapContext ctx); void stop(); void endpointActivation(MessageEndpointFactory messageEndpointFactory, ActivationSpec activationSpec); void endpointDeactivation(MessageEndpointFactory endpointFactory, ActivationSpec spec); XAResource[] getXAResources(ActivationSpec[] arg0); void setIpAddress(String defaultIpAddress); void setEncoding(String defaultEncoding); void setMaximumConnections(int defaultMaximumConnections); void setMaximumConnections(Integer defaultMaximumConnections); void setConnectionTimeoutMilliseconds(int defaultConnectionTimeoutMilliseconds); void setConnectionTimeoutMilliseconds(Integer defaultConnectionTimeoutMilliseconds); String getEncoding(); int getMaximumConnections(); int getConnectionTimeoutMilliseconds();  }
@Test(expected=ResourceException.class) public void testEndPointActivationOfDuplicateSpecsFails() throws ResourceException { int port = 100; SocketActivationSpec socketActivationSpec1 = createActivationSpec(port); SocketActivationSpec socketActivationSpec2 = createActivationSpec(port); socketResourceAdapter.endpointActivation(messageEndpointFactory.getMock(), socketActivationSpec1); socketResourceAdapter.endpointActivation(messageEndpointFactory.getMock(), socketActivationSpec2); }