Package java.net

Examples of java.net.Socket.shutdownOutput()


      OutputStream outputStream = socket.getOutputStream();

      this.writeBytes(outputStream, requestBytes);

      socket.shutdownOutput();

      InputStream inputStream = socket.getInputStream();

      byte[] bytes = this.readBytes(inputStream);
      return bytes;
View Full Code Here


        Socket sock = this.socket;
        try {
            doFlush();
            try {
                try {
                    sock.shutdownOutput();
                } catch (IOException ignore) {
                }
                try {
                    sock.shutdownInput();
                } catch (IOException ignore) {
View Full Code Here

        Socket sock = this.socket;
        try {
            doFlush();
            try {
                try {
                    sock.shutdownOutput();
                } catch (IOException ignore) {
                }
                try {
                    sock.shutdownInput();
                } catch (IOException ignore) {
View Full Code Here

        int data;
        while ((data = requestMsgInStream.read()) != -1) {
            outStream.write(data);
        }
        outStream.flush();
        socket.shutdownOutput();
        BufferedReader reader = new BufferedReader(new InputStreamReader(socket
                .getInputStream()));
        StringBuffer sb = new StringBuffer();

        String response = reader.readLine();
View Full Code Here

                break;
            }
        }

        println("shutting down socket...");
        s.shutdownOutput();
        s.shutdownInput();
        s.close();

        println("done test1...");
    }
View Full Code Here

            String requestMessage = soapCreater.getStringFromSOAPMessage(testNumber, netUrl);
            PrintWriter out = new PrintWriter(
                    socket.getOutputStream());
            out.println(requestMessage);
            out.flush();
            socket.shutdownOutput();
            return socket.getInputStream();
        } catch (MalformedURLException e) {
            log.info(e.getMessage());
        } catch (IOException e) {
            log.info(e.getMessage());
View Full Code Here

      public void run() {
        while (true) { // fetching does a few retries
          try {
            Socket s = socket.accept();
            s.getOutputStream().write(1234);
            s.shutdownOutput();
          } catch (Exception e) {
            break;
          }
        }
      }
View Full Code Here

    InputStream theInput = theSocket.getInputStream();
    OutputStream theOutput = servSock.getOutputStream();

    // shutdown the output
    servSock.shutdownOutput();

    // send the regular data
    String sendString = new String("Test");
    try {
      theOutput.write(sendString.getBytes());
View Full Code Here

    // make sure we get the right answer with newly connected socket
    assertFalse("Socket indicated output shutdown when it should not have",
        servSock.isOutputShutdown());

    // shutdown the output
    servSock.shutdownOutput();

    // make sure we get the right answer once it is shut down
    assertTrue(
        "Socket indicated output was NOT shutdown when it should have been",
        servSock.isOutputShutdown());
View Full Code Here

    public void test_getOutputStream_shutdownOutput() throws Exception {
        // regression test for Harmony-873
        ServerSocket ss = new ServerSocket(0);
        Socket s = new Socket("127.0.0.1", ss.getLocalPort());
        ss.accept();
        s.shutdownOutput();
        try {
            s.getOutputStream();
            fail("should throw SocketException");
        } catch (SocketException e) {
            // expected
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.