Package java.net

Examples of java.net.Socket.connect()


     
      if ( testDescription != null ) {
        LOG.info("Testing : " + testDescription);
      }
      sock = new Socket();
      sock.connect(dnAddr, HdfsConstants.READ_TIMEOUT);
      sock.setSoTimeout(HdfsConstants.READ_TIMEOUT);
     
      OutputStream out = sock.getOutputStream();
      // Should we excuse
      byte[] retBuf = new byte[recvBuf.size()];
View Full Code Here


      InetSocketAddress targetAddr = NetUtils.createSocketAddr(
          chosenNode.getHost() + ":" + chosenNode.getInfoPort());
       
      try {
        s = new Socket();
        s.connect(targetAddr, HdfsConstants.READ_TIMEOUT);
        s.setSoTimeout(HdfsConstants.READ_TIMEOUT);
      } catch (IOException e) {
        deadNodes.add(chosenNode);
        s.close();
        s = null;
View Full Code Here

                                 JspWriter out,
                                 Configuration conf)
    throws IOException {
    if (chunkSizeToView == 0) return;
    Socket s = new Socket();
    s.connect(addr, HdfsConstants.READ_TIMEOUT);
    s.setSoTimeout(HdfsConstants.READ_TIMEOUT);
     
      long amtToRead = Math.min(chunkSizeToView, blockSize - offsetIntoBlock);    
     
      // Use the block name for file name.
View Full Code Here

        failures++;
        continue;
      }
      try {
        s = new Socket();
        s.connect(targetAddr, HdfsConstants.READ_TIMEOUT);
        s.setSoTimeout(HdfsConstants.READ_TIMEOUT);
       
        blockReader =
          DFSClient.BlockReader.newBlockReader(s, targetAddr.toString() + ":" +
                                               block.getBlockId(),
View Full Code Here

        Socket socket = new Socket();
        socket.setSoTimeout(definition.getReadTimeoutMs());
        socket.setSendBufferSize(definition.getMessage().length);
        socket.setReceiveBufferSize(definition.getExpectedResponse().length);

        socket.connect(socketAddress, definition.getConnectionTimeoutMs());
        try {
            return processSocket(definition, socket);
        } finally {
            socket.close();
        }
View Full Code Here

            Log.debug("Using Regular Socket");
            socket = SocketFactory.getDefault().createSocket();               
        }
      
        Address address = destination.isProxied() ? destination.getProxy() : destination.getAddress();
        socket.connect(address.toSocketAddress());
       
        EndPoint endpoint=new SocketEndPoint(socket);
       
        final HttpConnection connection=new HttpConnection(_httpClient,endpoint,_httpClient.getHeaderBufferSize(),_httpClient.getRequestBufferSize());
        connection.setDestination(destination);
View Full Code Here

                  }
                  if (this.sock.isClosed()) {
                    JHBServlet.dbg("socket closed", 1);
                    // reconnect
                    Socket s = new Socket();
                    s.connect(this.sock
                        .getRemoteSocketAddress(),
                        SOCKET_TIMEOUT);
                    this.sock = s;
                    this.sock.setSoTimeout(SOCKET_TIMEOUT);
                    this.br = new BufferedReader(
View Full Code Here

      socket = new Socket();
    }
    int timeout = connection.getTimeout();
    socket.setTcpNoDelay(true);
    socket.setSoTimeout(timeout);
    socket.connect(new InetSocketAddress(host, port), timeout);
    trans = new TSocket(socket);

    TProtocol proto = new TBinaryProtocol(new TFramedTransport(trans));
    Client client = new Client(proto);
    return client;
View Full Code Here

    int port = sp.length > 1 ? Integer.parseInt(sp[1])
        : HConstants.DEFAULT_ZOOKEPER_CLIENT_PORT;

    Socket socket = new Socket();
    InetSocketAddress sockAddr = new InetSocketAddress(host, port);
    socket.connect(sockAddr, timeout);

    socket.setSoTimeout(timeout);
    PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
    BufferedReader in = new BufferedReader(new InputStreamReader(
      socket.getInputStream()));
View Full Code Here

        int connTimeout = HttpConnectionParams.getConnectionTimeout(params);
        int soTimeout = HttpConnectionParams.getSoTimeout(params);

        try {
            sock.setSoTimeout(soTimeout);
            sock.connect(remoteAddress, connTimeout);
        } catch (SocketTimeoutException ex) {
            throw new ConnectTimeoutException("Connect to " + remoteAddress + " timed out");
        }

        // HttpInetSocketAddress#toString() returns original hostname value of the remote address
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.