Index: src/main/java/java/net/Socket.java =================================================================== --- src/main/java/java/net/Socket.java (revision 494388) +++ src/main/java/java/net/Socket.java (working copy) @@ -696,6 +696,9 @@ * if the socket is closed */ public void shutdownInput() throws IOException { + if (isInputShutdown()) { + throw new SocketException(Msg.getString("K0321")); //$NON-NLS-1$ + } checkClosedAndCreate(false); impl.shutdownInput(); isInputShutdown = true; Index: src/test/java/tests/api/java/net/SocketTest.java =================================================================== --- src/test/java/tests/api/java/net/SocketTest.java (revision 494388) +++ src/test/java/tests/api/java/net/SocketTest.java (working copy) @@ -2451,7 +2451,23 @@ // expected } } - + + /** + * @tests Socket#shutdownInput() + */ + public void test_shutdownInput_twice() throws Exception { + // regression test for Harmony-2944 + Socket s = new Socket("0.0.0.0", 0, false); + s.shutdownInput(); + + try { + s.shutdownInput(); + fail("should throw SocketException"); + } catch (SocketException se) { + // expected + } + } + /** * Sets up the fixture, for example, open a network connection. This method * is called before a test is executed.