Examples of SocketFactory


Examples of javax.net.SocketFactory

  }

  @Test
  public void testRTEDuringConnectionSetup() throws Exception {
    Configuration conf = HBaseConfiguration.create();
    SocketFactory spyFactory = spy(NetUtils.getDefaultSocketFactory(conf));
    Mockito.doAnswer(new Answer<Socket>() {
      @Override
      public Socket answer(InvocationOnMock invocation) throws Throwable {
        Socket s = spy((Socket)invocation.callRealMethod());
        doThrow(new RuntimeException("Injected fault")).when(s).setSoTimeout(anyInt());
View Full Code Here

Examples of javax.net.SocketFactory

        Tomcat.addServlet(ctx, servletName, servlet);
        ctx.addServletMapping("/", servletName);
        tomcat.getConnector().setProperty("socket.txBufSize", "1024");
        tomcat.start();

        SocketFactory factory = SocketFactory.getDefault();
        Socket s = factory.createSocket("localhost", getPort());

        ByteChunk result = new ByteChunk();
        OutputStream os = s.getOutputStream();
        os.write(("GET / HTTP/1.1\r\n" +
                "Host: localhost:" + getPort() + "\r\n" +
View Full Code Here

Examples of javax.net.SocketFactory

        Tomcat.addServlet(ctx, servletName, servlet);
        ctx.addServletMapping("/", servletName);
        tomcat.getConnector().setProperty("socket.txBufSize", "1024");
        tomcat.start();

        SocketFactory factory = SocketFactory.getDefault();
        Socket s = factory.createSocket("localhost", getPort());

        ByteChunk result = new ByteChunk();
        OutputStream os = s.getOutputStream();
        os.write(("GET / HTTP/1.1\r\n" +
                "Host: localhost:" + getPort() + "\r\n" +
View Full Code Here

Examples of org.apache.avalon.cornerstone.services.sockets.SocketFactory

     * @exception Exception if socket factory is not available
     */
    public SocketFactory getSocketFactory( final String name )
        throws Exception
    {
        final SocketFactory factory = (SocketFactory)m_sockets.get( name );

        if( null != factory )
        {
            return factory;
        }
View Full Code Here

Examples of org.apache.axis.components.net.SocketFactory

     * @throws Exception
     */
    private Socket getSecureSocket(
            String host, int port, StringBuffer otherHeaders, BooleanHolder useFullURL)
            throws Exception {
        SocketFactory factory = SocketFactoryFactory.getSecureFactory(getOptions());
        return factory.create(host, port, otherHeaders, useFullURL);
    }
View Full Code Here

Examples of org.apache.commons.net.SocketFactory

            try
            {
              if(System.getProperty("org.apache.commons.net.socketFactory", null)!=null) {
                               
                try {
                SocketFactory socketFactory = (SocketFactory) Class.forName(System.getProperty("org.apache.commons.net.socketFactory")).newInstance();
                client.setSocketFactory(socketFactory);
                } catch(Throwable t) {
                  throw new FileSystemException(t);
                }
              }
View Full Code Here

Examples of org.apache.http.conn.SocketFactory

    private final static void setup() {

        // Register the "http" and "https" protocol schemes, they are
        // required by the default operator to look up socket factories.
        supportedSchemes = new SchemeRegistry();
        SocketFactory sf = PlainSocketFactory.getSocketFactory();
        supportedSchemes.register(new Scheme("http", sf, 80));
        sf = SSLSocketFactory.getSocketFactory();
        supportedSchemes.register(new Scheme("https", sf, 80));

        // Prepare parameters.
View Full Code Here

Examples of org.apache.http.conn.scheme.SocketFactory

        if (conn.isOpen()) {
            throw new IllegalArgumentException
                ("Connection must not be open.");
        }

        SocketFactory sf = null;
        LayeredSocketFactory layeredsf = null;
       
        Scheme schm = schemeRegistry.getScheme(target.getSchemeName());
        sf = schm.getSocketFactory();
        if (sf instanceof LayeredSocketFactory) {
            layeredsf = (LayeredSocketFactory) sf;
            sf = PlainSocketFactory.getSocketFactory();
        }

        InetAddress[] addresses = InetAddress.getAllByName(target.getHostName());
        for (int i = 0; i < addresses.length; i++) {
            InetAddress address = addresses[i];
            boolean last = i == addresses.length - 1;
            Socket sock = sf.createSocket();
            conn.opening(sock, target);
            try {
                Socket connsock = sf.connectSocket(
                        sock,
                        address.getHostAddress(),
                        schm.resolvePort(target.getPort()),
                        local, 0, params);
                if (sock != connsock) {
                    sock = connsock;
                    conn.opening(sock, target);
                }
                if (layeredsf != null) {
                    connsock = layeredsf.createSocket(
                            sock,
                            address.getHostAddress(),
                            schm.resolvePort(target.getPort()),
                            true);
                    if (sock != connsock) {
                        sock = connsock;
                        conn.opening(sock, target);
                    }
                    sf = layeredsf;
                }
                prepareSocket(sock, context, params);
                conn.openCompleted(sf.isSecure(sock), params);
                break;
            } catch (ConnectException ex) {
                if (last) {
                    throw new HttpHostConnectException(target, ex);
                }
View Full Code Here

Examples of org.apache.http.conn.scheme.SocketFactory

     * @return the default scheme registry
     */
    public SchemeRegistry createSchemeRegistry() {

        SchemeRegistry schreg = new SchemeRegistry();
        SocketFactory sf = PlainSocketFactory.getSocketFactory();
        schreg.register(new Scheme("http", sf, 80));

        return schreg;
    }
View Full Code Here

Examples of org.apache.http.conn.scheme.SocketFactory

                (defaultParams, false);
        }

        if (supportedSchemes == null) {
            supportedSchemes = new SchemeRegistry();
            SocketFactory sf = PlainSocketFactory.getSocketFactory();
            supportedSchemes.register(new Scheme("http", sf, 80));
        }

        if (httpProcessor == null) {
            httpProcessor = new BasicHttpProcessor();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.