congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
SocketFactory
Code IndexAdd Tabnine to your IDE (free)

How to use
SocketFactory
in
jrds.starter

Best Java code snippets using jrds.starter.SocketFactory (Showing top 20 results out of 315)

origin: fbacchella/jrds

public JrdsSocketConnection(String host, int port, SocketFactory sf) throws IOException {
  super(sf.createSocket(host, port));
  this.host = host;
  this.port = port;
}
origin: fbacchella/jrds

/**
 * @return the timeout
 */
public int getTimeout() {
  return getLevel().getTimeout();
}
origin: fbacchella/jrds

public Socket createSocket(String host, int port) throws IOException {
  if(!isStarted())
    return null;
  Socket s = getSocket();
  s.connect(new InetSocketAddress(host, port), getTimeout());
  return s;
}
origin: fbacchella/jrds

public Socket createSocket() throws IOException {
  if(!isStarted())
    return null;
  return getSocket();
}
origin: fbacchella/jrds

public ServerSocket createServerSocket(int port) throws IOException {
  if(!isStarted())
    return null;
  ServerSocket s = new ServerSocket(port) {
    /*
     * (non-Javadoc)
     * 
     * @see java.net.ServerSocket#accept()
     */
    @Override
    public Socket accept() throws IOException {
      Socket accepted = super.accept();
      accepted.setTcpNoDelay(true);
      return accepted;
    }
  };
  s.setSoTimeout(getTimeout() * 1000);
  return s;
}
origin: fbacchella/jrds

try {
  SocketFactory ss = find(SocketFactory.class);
  if(!ss.isStarted())
    return null;
  s = ss.createSocket(this, port);
} catch (Exception e) {
  log(Level.ERROR, e, "Connect error %s", e);
origin: fbacchella/jrds

  @Override
  public void connect(SocketAddress endpoint, int timeout) throws IOException {
    super.connect(endpoint, getTimeout() * 1000);
  }
};
origin: fbacchella/jrds

private HostStarter addConnection(Starter cnx) throws IOException {
  String truststore = getClass().getClassLoader().getResource("localhost.jks").getFile();
  PropertiesManager pm = Tools.makePm(testFolder, "timeout=1", "collectorThreads=1",
      "ssl.protocol=TLS", "ssl.strict=true", "ssl.truststore=" + truststore, "ssl.trustpassword=123456");
  HostStarter localhost = new HostStarter(new HostInfo("localhost"));
  Timer t = Tools.getDefaultTimer();
  localhost.setParent(t);
  localhost.getHost().setHostDir(testFolder.getRoot());
  t.registerStarter(new SSLStarter());
  t.registerStarter(new SocketFactory());
  t.configureStarters(pm);
  localhost.registerStarter(cnx);
  cnx.configure(pm);
  return localhost;
}
origin: fbacchella/jrds

@Override
public boolean isStarted(Object key) {
  return super.isStarted(key) && find(XmlProvider.class).isStarted() && find(SocketFactory.class).isStarted();
}
origin: fbacchella/jrds

public void connect(SocketAddress endpoint) throws IOException {
  super.connect(endpoint, getTimeout() * 1000);
}
origin: fbacchella/jrds

@SuppressWarnings("unused")
private void doTest(String proto, int port) throws Exception {
  mbi = new JrdsMBeanInfo(proto, "localhost", port);
  HostStarter host = new HostStarter(new HostInfo("localhost")) {
    public boolean isCollectRunning() {
      return true;
    }
  };
  host.setTimeout(1);
  JMXConnection cnx = getCnx(proto, port);
  host.registerStarter(new SocketFactory());
  host.registerStarter(new JmxSocketFactory());
  host.registerStarter(cnx);
  host.configureStarters(new PropertiesManager());
  host.startCollect();
  Assert.assertTrue("JMX Connection failed to start", cnx.isStarted());
  Assert.assertNotNull("Failed to read uptime", cnx.setUptime());
  if(false)
    enumerate((NativeJmxSource)cnx.getConnection());
}
origin: fbacchella/jrds

public Socket createSocket(StarterNode host, int port) throws IOException {
  if(!isStarted())
    return null;
  Resolver r = host.find(Resolver.class);
  if(r == null || !r.isStarted())
    return null;
  Socket s = getSocket();
  s.connect(new InetSocketAddress(r.getInetAddress(), port), getTimeout());
  return s;
}
origin: fbacchella/jrds

  @Override
  public Socket createSocket(HttpContext context) throws IOException {
    return ss.createSocket();
  }
};
origin: fbacchella/jrds

private Socket getSocket() throws SocketException {
  Socket s = new Socket() {
    public void connect(SocketAddress endpoint) throws IOException {
      super.connect(endpoint, getTimeout() * 1000);
    }
    @Override
    public void connect(SocketAddress endpoint, int timeout) throws IOException {
      super.connect(endpoint, getTimeout() * 1000);
    }
  };
  s.setSoTimeout(getTimeout() * 1000);
  s.setTcpNoDelay(true);
  return s;
}
origin: fbacchella/jrds

@Override
public boolean startConnection() {
  SocketFactory ss = getLevel().find(SocketFactory.class);
  channel = new SocketChannels();
  try {
    channel.muninsSocket = ss.createSocket(getHostName(), port);
    channel.out = new PrintWriter(channel.muninsSocket.getOutputStream(), true);
    channel.in = new BufferedReader(new InputStreamReader(channel.muninsSocket.getInputStream()));
  } catch (IOException e) {
    log(Level.ERROR, e, "Connection error", e.getMessage());
    return false;
  }
  return true;
}
origin: fbacchella/jrds

Socket makeSocket(String host, int port) throws IOException {
  SocketFactory sf = getLevel().find(SocketFactory.class);
  return sf.createSocket(host, port);
}
origin: fbacchella/jrds

public Socket connect(String host, int port) throws NoSuchAlgorithmException, KeyManagementException, IOException {
  SocketFactory ss = getLevel().find(SocketFactory.class);
  Socket s = ss.createSocket(host, port);
  SSLSocketFactory ssf = getContext().getSocketFactory();
  s = ssf.createSocket(s, host, port, true);
  log(Level.DEBUG, "done SSL handshake for %s", host);
  return s;
}
origin: fbacchella/jrds

private Socket connect() throws NoSuchAlgorithmException, KeyManagementException, IOException {
  if(port == 23) {
    SocketFactory ss = find(SocketFactory.class);
    return ss.createSocket(iloHost, port);
  } else {
    return find(SSLStarter.class).connect(iloHost, port);
  }
}
origin: fbacchella/jrds

  public Socket createSocket(String host, int port) throws IOException {
    log(Level.DEBUG, "creating a RMI socket to %s:%d", host, port);
    return getLevel().find(SocketFactory.class).createSocket(host, port);
  }
}
origin: fbacchella/jrds

public Socket createSocket(String host, int port) throws IOException {
  log(Level.DEBUG, "creating a RMI socket to %s:%d", host, port);
  return getLevel().find(SocketFactory.class).createSocket(host, port);
}
jrds.starterSocketFactory

Most used methods

  • <init>
  • createSocket
  • getLevel
  • getSocket
  • getTimeout
  • isStarted

Popular in Java

  • Making http post requests using okhttp
  • getResourceAsStream (ClassLoader)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • notifyDataSetChanged (ArrayAdapter)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • JComboBox (javax.swing)
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now