congrats Icon
New! Announcing our next generation AI code completions
Read here
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

  • Creating JSON documents from java classes using gson
  • compareTo (BigDecimal)
  • getSupportFragmentManager (FragmentActivity)
  • getSharedPreferences (Context)
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • 21 Best Atom Packages for 2021
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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