Helper to wrap a buffer, pretending the sasl client simply prepends the length. @throws Exception it really shouldn't. Really.
()
| 176 | * @throws Exception it really shouldn't. Really. |
| 177 | */ |
| 178 | protected void setupWrap() throws Exception { |
| 179 | when(sasl_client.wrap(any(byte[].class), anyInt(), anyInt())) |
| 180 | .thenAnswer(new Answer<byte[]>() { |
| 181 | @Override |
| 182 | public byte[] answer(final InvocationOnMock invocation) |
| 183 | throws Throwable { |
| 184 | final byte[] buffer = (byte[])invocation.getArguments()[0]; |
| 185 | final int length = (Integer)invocation.getArguments()[2]; |
| 186 | final byte[] wrapped = new byte[length + 4]; |
| 187 | System.arraycopy(buffer, 0, wrapped, 4, length); |
| 188 | Bytes.setInt(wrapped, length); |
| 189 | return wrapped; |
| 190 | } |
| 191 | }); |
| 192 | } |
| 193 | |
| 194 | @SuppressWarnings("unchecked") |
| 195 | protected void setupChallenge() throws Exception { |
no test coverage detected